liteagents 2.9.0 → 2.11.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 (117) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +27 -33
  3. package/installer/cli.js +6 -2
  4. package/package.json +3 -3
  5. package/packages/ampcode/AGENT.md +11 -16
  6. package/packages/ampcode/agents/code-developer.md +11 -12
  7. package/packages/ampcode/agents/quality-assurance.md +1 -1
  8. package/packages/{droid/commands/systematic-debugging.md → ampcode/commands/debug-method.md} +9 -9
  9. package/packages/ampcode/commands/diff-review.md +78 -0
  10. package/packages/ampcode/commands/friction/friction.js +28 -6
  11. package/packages/ampcode/commands/optimize.md +45 -4
  12. package/packages/ampcode/commands/refactor.md +33 -1
  13. package/packages/ampcode/commands/release.md +88 -0
  14. package/packages/ampcode/commands/remember.md +34 -3
  15. package/packages/ampcode/commands/security.md +28 -1
  16. package/packages/ampcode/commands/stash.md +7 -0
  17. package/packages/{droid/commands/test-driven-development.md → ampcode/commands/tdd-flow.md} +2 -2
  18. package/packages/ampcode/commands/test-generate.md +64 -15
  19. package/packages/{opencode/command/testing-anti-patterns.md → ampcode/commands/test-traps.md} +77 -3
  20. package/packages/{droid/commands/root-cause-tracing.md → ampcode/commands/trace-back.md} +3 -3
  21. package/packages/ampcode/commands/{verification-before-completion.md → verify-done.md} +3 -3
  22. package/packages/claude/CLAUDE.md +10 -15
  23. package/packages/claude/agents/code-developer.md +11 -12
  24. package/packages/claude/agents/quality-assurance.md +1 -1
  25. package/packages/claude/commands/diff-review.md +78 -0
  26. package/packages/claude/commands/friction/friction.js +28 -6
  27. package/packages/claude/commands/optimize.md +45 -4
  28. package/packages/claude/commands/refactor.md +33 -1
  29. package/packages/claude/commands/release.md +88 -0
  30. package/packages/claude/commands/remember.md +34 -3
  31. package/packages/claude/commands/security.md +28 -1
  32. package/packages/claude/commands/stash.md +7 -0
  33. package/packages/claude/commands/test-generate.md +64 -15
  34. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package-lock.json +3 -3
  35. package/packages/claude/skills/{systematic-debugging → debug-method}/CREATION-LOG.md +1 -1
  36. package/packages/claude/skills/{systematic-debugging → debug-method}/SKILL.md +9 -9
  37. package/packages/claude/skills/{systematic-debugging → debug-method}/test-academic.md +1 -1
  38. package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-1.md +1 -1
  39. package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-2.md +1 -1
  40. package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-3.md +1 -1
  41. package/packages/claude/skills/{test-driven-development → tdd-flow}/SKILL.md +3 -3
  42. package/packages/claude/skills/{testing-anti-patterns → test-traps}/SKILL.md +77 -3
  43. package/packages/claude/skills/{root-cause-tracing → trace-back}/SKILL.md +3 -3
  44. package/packages/claude/skills/{verification-before-completion → verify-done}/SKILL.md +3 -3
  45. package/packages/droid/AGENTS.md +9 -14
  46. package/packages/{opencode/command/systematic-debugging.md → droid/commands/debug-method.md} +9 -9
  47. package/packages/droid/commands/diff-review.md +78 -0
  48. package/packages/droid/commands/friction/friction.js +28 -6
  49. package/packages/droid/commands/optimize.md +45 -4
  50. package/packages/droid/commands/refactor.md +33 -1
  51. package/packages/droid/commands/release.md +88 -0
  52. package/packages/droid/commands/remember.md +34 -3
  53. package/packages/droid/commands/security.md +28 -1
  54. package/packages/droid/commands/stash.md +7 -0
  55. package/packages/{opencode/command/test-driven-development.md → droid/commands/tdd-flow.md} +2 -2
  56. package/packages/droid/commands/test-generate.md +64 -15
  57. package/packages/droid/commands/{testing-anti-patterns.md → test-traps.md} +77 -3
  58. package/packages/{opencode/command/root-cause-tracing.md → droid/commands/trace-back.md} +3 -3
  59. package/packages/droid/commands/{verification-before-completion.md → verify-done.md} +3 -3
  60. package/packages/droid/droids/code-developer.md +11 -12
  61. package/packages/droid/droids/quality-assurance.md +1 -1
  62. package/packages/opencode/AGENTS.md +9 -14
  63. package/packages/opencode/agent/code-developer.md +11 -12
  64. package/packages/opencode/agent/quality-assurance.md +1 -1
  65. package/packages/{ampcode/commands/systematic-debugging.md → opencode/command/debug-method.md} +9 -9
  66. package/packages/opencode/command/diff-review.md +78 -0
  67. package/packages/opencode/command/friction/friction.js +28 -6
  68. package/packages/opencode/command/optimize.md +45 -4
  69. package/packages/opencode/command/refactor.md +33 -1
  70. package/packages/opencode/command/release.md +88 -0
  71. package/packages/opencode/command/remember.md +34 -3
  72. package/packages/opencode/command/security.md +28 -1
  73. package/packages/opencode/command/stash.md +7 -0
  74. package/packages/{ampcode/commands/test-driven-development.md → opencode/command/tdd-flow.md} +2 -2
  75. package/packages/opencode/command/test-generate.md +64 -15
  76. package/packages/{ampcode/commands/testing-anti-patterns.md → opencode/command/test-traps.md} +77 -3
  77. package/packages/{ampcode/commands/root-cause-tracing.md → opencode/command/trace-back.md} +3 -3
  78. package/packages/opencode/command/{verification-before-completion.md → verify-done.md} +3 -3
  79. package/packages/opencode/opencode.jsonc +16 -36
  80. package/packages/subagentic-manual.md +56 -51
  81. package/packages/ampcode/commands/code-review.md +0 -107
  82. package/packages/ampcode/commands/condition-based-waiting.md +0 -122
  83. package/packages/ampcode/commands/debug.md +0 -20
  84. package/packages/ampcode/commands/explain.md +0 -18
  85. package/packages/ampcode/commands/friction.md +0 -139
  86. package/packages/ampcode/commands/git-commit.md +0 -14
  87. package/packages/ampcode/commands/review.md +0 -18
  88. package/packages/claude/commands/debug.md +0 -20
  89. package/packages/claude/commands/explain.md +0 -18
  90. package/packages/claude/commands/friction.md +0 -139
  91. package/packages/claude/commands/git-commit.md +0 -14
  92. package/packages/claude/commands/review.md +0 -18
  93. package/packages/claude/skills/code-review/SKILL.md +0 -107
  94. package/packages/claude/skills/code-review/code-reviewer.md +0 -146
  95. package/packages/claude/skills/condition-based-waiting/SKILL.md +0 -122
  96. package/packages/droid/commands/code-review.md +0 -107
  97. package/packages/droid/commands/condition-based-waiting.md +0 -122
  98. package/packages/droid/commands/debug.md +0 -20
  99. package/packages/droid/commands/explain.md +0 -18
  100. package/packages/droid/commands/friction.md +0 -139
  101. package/packages/droid/commands/git-commit.md +0 -14
  102. package/packages/droid/commands/review.md +0 -18
  103. package/packages/opencode/command/code-review.md +0 -107
  104. package/packages/opencode/command/condition-based-waiting.md +0 -122
  105. package/packages/opencode/command/debug.md +0 -20
  106. package/packages/opencode/command/explain.md +0 -18
  107. package/packages/opencode/command/friction.md +0 -139
  108. package/packages/opencode/command/git-commit.md +0 -14
  109. package/packages/opencode/command/review.md +0 -18
  110. /package/packages/ampcode/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
  111. /package/packages/ampcode/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
  112. /package/packages/claude/skills/{condition-based-waiting → test-traps}/example.ts +0 -0
  113. /package/packages/claude/skills/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
  114. /package/packages/droid/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
  115. /package/packages/droid/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
  116. /package/packages/opencode/command/{condition-based-waiting → test-traps}/example.ts +0 -0
  117. /package/packages/opencode/command/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
@@ -1,122 +0,0 @@
1
- ---
2
- name: condition-based-waiting
3
- description: Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses
4
- usage: /condition-based-waiting <condition-type> <timeout-specs>
5
- auto_trigger: false
6
- ---
7
-
8
- # Condition-Based Waiting
9
-
10
- ## Overview
11
-
12
- Flaky tests often guess at timing with arbitrary delays. This creates race conditions where tests pass on fast machines but fail under load or in CI.
13
-
14
- **Core principle:** Wait for the actual condition you care about, not a guess about how long it takes.
15
-
16
- ## When to Use
17
-
18
- ```dot
19
- digraph when_to_use {
20
- "Test uses setTimeout/sleep?" [shape=diamond];
21
- "Testing timing behavior?" [shape=diamond];
22
- "Document WHY timeout needed" [shape=box];
23
- "Use condition-based waiting" [shape=box];
24
-
25
- "Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
26
- "Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
27
- "Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
28
- }
29
- ```
30
-
31
- **Use when:**
32
- - Tests have arbitrary delays (`setTimeout`, `sleep`, `time.sleep()`)
33
- - Tests are flaky (pass sometimes, fail under load)
34
- - Tests timeout when run in parallel
35
- - Waiting for async operations to complete
36
-
37
- **Don't use when:**
38
- - Testing actual timing behavior (debounce, throttle intervals)
39
- - Always document WHY if using arbitrary timeout
40
-
41
- ## Core Pattern
42
-
43
- ```typescript
44
- // ❌ BEFORE: Guessing at timing
45
- await new Promise(r => setTimeout(r, 50));
46
- const result = getResult();
47
- expect(result).toBeDefined();
48
-
49
- // ✅ AFTER: Waiting for condition
50
- await waitFor(() => getResult() !== undefined);
51
- const result = getResult();
52
- expect(result).toBeDefined();
53
- ```
54
-
55
- ## Quick Patterns
56
-
57
- | Scenario | Pattern |
58
- |----------|---------|
59
- | Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
60
- | Wait for state | `waitFor(() => machine.state === 'ready')` |
61
- | Wait for count | `waitFor(() => items.length >= 5)` |
62
- | Wait for file | `waitFor(() => fs.existsSync(path))` |
63
- | Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
64
-
65
- ## Implementation
66
-
67
- Generic polling function:
68
- ```typescript
69
- async function waitFor<T>(
70
- condition: () => T | undefined | null | false,
71
- description: string,
72
- timeoutMs = 5000
73
- ): Promise<T> {
74
- const startTime = Date.now();
75
-
76
- while (true) {
77
- const result = condition();
78
- if (result) return result;
79
-
80
- if (Date.now() - startTime > timeoutMs) {
81
- throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
82
- }
83
-
84
- await new Promise(r => setTimeout(r, 10)); // Poll every 10ms
85
- }
86
- }
87
- ```
88
-
89
- See @example.ts for complete implementation with domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) from actual debugging session.
90
-
91
- ## Common Mistakes
92
-
93
- **❌ Polling too fast:** `setTimeout(check, 1)` - wastes CPU
94
- **✅ Fix:** Poll every 10ms
95
-
96
- **❌ No timeout:** Loop forever if condition never met
97
- **✅ Fix:** Always include timeout with clear error
98
-
99
- **❌ Stale data:** Cache state before loop
100
- **✅ Fix:** Call getter inside loop for fresh data
101
-
102
- ## When Arbitrary Timeout IS Correct
103
-
104
- ```typescript
105
- // Tool ticks every 100ms - need 2 ticks to verify partial output
106
- await waitForEvent(manager, 'TOOL_STARTED'); // First: wait for condition
107
- await new Promise(r => setTimeout(r, 200)); // Then: wait for timed behavior
108
- // 200ms = 2 ticks at 100ms intervals - documented and justified
109
- ```
110
-
111
- **Requirements:**
112
- 1. First wait for triggering condition
113
- 2. Based on known timing (not guessing)
114
- 3. Comment explaining WHY
115
-
116
- ## Real-World Impact
117
-
118
- From debugging session (2025-10-03):
119
- - Fixed 15 flaky tests across 3 files
120
- - Pass rate: 60% → 100%
121
- - Execution time: 40% faster
122
- - No more race conditions
@@ -1,107 +0,0 @@
1
- ---
2
- name: code-review
3
- description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements - reviews implementation against plan or requirements before proceeding
4
- usage: /code-review <review-scope> <focus-areas>
5
- auto_trigger: false
6
- ---
7
-
8
- # Requesting Code Review
9
-
10
- Review code thoroughly to catch issues before they cascade.
11
-
12
- **Core principle:** Review early, review often.
13
-
14
- ## When to Request Review
15
-
16
- **Mandatory:**
17
- - After each task in subagent-driven development
18
- - After completing major feature
19
- - Before merge to main
20
-
21
- **Optional but valuable:**
22
- - When stuck (fresh perspective)
23
- - Before refactoring (baseline check)
24
- - After fixing complex bug
25
-
26
- ## How to Request
27
-
28
- **1. Get git SHAs:**
29
- ```bash
30
- BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
31
- HEAD_SHA=$(git rev-parse HEAD)
32
- ```
33
-
34
- **2. Conduct code review:**
35
-
36
- Review implementation against requirements and plan
37
-
38
- **Placeholders:**
39
- - `{WHAT_WAS_IMPLEMENTED}` - What you just built
40
- - `{PLAN_OR_REQUIREMENTS}` - What it should do
41
- - `{BASE_SHA}` - Starting commit
42
- - `{HEAD_SHA}` - Ending commit
43
- - `{DESCRIPTION}` - Brief summary
44
-
45
- **3. Act on feedback:**
46
- - Fix Critical issues immediately
47
- - Fix Important issues before proceeding
48
- - Note Minor issues for later
49
- - Push back if reviewer is wrong (with reasoning)
50
-
51
- ## Example
52
-
53
- ```
54
- [Just completed Task 2: Add verification function]
55
-
56
- You: Let me request code review before proceeding.
57
-
58
- BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
59
- HEAD_SHA=$(git rev-parse HEAD)
60
-
61
- [Conduct code review]
62
- WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
63
- PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
64
- BASE_SHA: a7981ec
65
- HEAD_SHA: 3df7661
66
- DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
67
-
68
- [Subagent returns]:
69
- Strengths: Clean architecture, real tests
70
- Issues:
71
- Important: Missing progress indicators
72
- Minor: Magic number (100) for reporting interval
73
- Assessment: Ready to proceed
74
-
75
- You: [Fix progress indicators]
76
- [Continue to Task 3]
77
- ```
78
-
79
- ## Integration with Workflows
80
-
81
- **Subagent-Driven Development:**
82
- - Review after EACH task
83
- - Catch issues before they compound
84
- - Fix before moving to next task
85
-
86
- **Executing Plans:**
87
- - Review after each batch (3 tasks)
88
- - Get feedback, apply, continue
89
-
90
- **Ad-Hoc Development:**
91
- - Review before merge
92
- - Review when stuck
93
-
94
- ## Red Flags
95
-
96
- **Never:**
97
- - Skip review because "it's simple"
98
- - Ignore Critical issues
99
- - Proceed with unfixed Important issues
100
- - Argue with valid technical feedback
101
-
102
- **If reviewer wrong:**
103
- - Push back with technical reasoning
104
- - Show code/tests that prove it works
105
- - Request clarification
106
-
107
- See template at: requesting-code-review/code-reviewer.md
@@ -1,122 +0,0 @@
1
- ---
2
- name: condition-based-waiting
3
- description: Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses
4
- usage: /condition-based-waiting <condition-type> <timeout-specs>
5
- auto_trigger: false
6
- ---
7
-
8
- # Condition-Based Waiting
9
-
10
- ## Overview
11
-
12
- Flaky tests often guess at timing with arbitrary delays. This creates race conditions where tests pass on fast machines but fail under load or in CI.
13
-
14
- **Core principle:** Wait for the actual condition you care about, not a guess about how long it takes.
15
-
16
- ## When to Use
17
-
18
- ```dot
19
- digraph when_to_use {
20
- "Test uses setTimeout/sleep?" [shape=diamond];
21
- "Testing timing behavior?" [shape=diamond];
22
- "Document WHY timeout needed" [shape=box];
23
- "Use condition-based waiting" [shape=box];
24
-
25
- "Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
26
- "Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
27
- "Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
28
- }
29
- ```
30
-
31
- **Use when:**
32
- - Tests have arbitrary delays (`setTimeout`, `sleep`, `time.sleep()`)
33
- - Tests are flaky (pass sometimes, fail under load)
34
- - Tests timeout when run in parallel
35
- - Waiting for async operations to complete
36
-
37
- **Don't use when:**
38
- - Testing actual timing behavior (debounce, throttle intervals)
39
- - Always document WHY if using arbitrary timeout
40
-
41
- ## Core Pattern
42
-
43
- ```typescript
44
- // ❌ BEFORE: Guessing at timing
45
- await new Promise(r => setTimeout(r, 50));
46
- const result = getResult();
47
- expect(result).toBeDefined();
48
-
49
- // ✅ AFTER: Waiting for condition
50
- await waitFor(() => getResult() !== undefined);
51
- const result = getResult();
52
- expect(result).toBeDefined();
53
- ```
54
-
55
- ## Quick Patterns
56
-
57
- | Scenario | Pattern |
58
- |----------|---------|
59
- | Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
60
- | Wait for state | `waitFor(() => machine.state === 'ready')` |
61
- | Wait for count | `waitFor(() => items.length >= 5)` |
62
- | Wait for file | `waitFor(() => fs.existsSync(path))` |
63
- | Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
64
-
65
- ## Implementation
66
-
67
- Generic polling function:
68
- ```typescript
69
- async function waitFor<T>(
70
- condition: () => T | undefined | null | false,
71
- description: string,
72
- timeoutMs = 5000
73
- ): Promise<T> {
74
- const startTime = Date.now();
75
-
76
- while (true) {
77
- const result = condition();
78
- if (result) return result;
79
-
80
- if (Date.now() - startTime > timeoutMs) {
81
- throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
82
- }
83
-
84
- await new Promise(r => setTimeout(r, 10)); // Poll every 10ms
85
- }
86
- }
87
- ```
88
-
89
- See @example.ts for complete implementation with domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) from actual debugging session.
90
-
91
- ## Common Mistakes
92
-
93
- **❌ Polling too fast:** `setTimeout(check, 1)` - wastes CPU
94
- **✅ Fix:** Poll every 10ms
95
-
96
- **❌ No timeout:** Loop forever if condition never met
97
- **✅ Fix:** Always include timeout with clear error
98
-
99
- **❌ Stale data:** Cache state before loop
100
- **✅ Fix:** Call getter inside loop for fresh data
101
-
102
- ## When Arbitrary Timeout IS Correct
103
-
104
- ```typescript
105
- // Tool ticks every 100ms - need 2 ticks to verify partial output
106
- await waitForEvent(manager, 'TOOL_STARTED'); // First: wait for condition
107
- await new Promise(r => setTimeout(r, 200)); // Then: wait for timed behavior
108
- // 200ms = 2 ticks at 100ms intervals - documented and justified
109
- ```
110
-
111
- **Requirements:**
112
- 1. First wait for triggering condition
113
- 2. Based on known timing (not guessing)
114
- 3. Comment explaining WHY
115
-
116
- ## Real-World Impact
117
-
118
- From debugging session (2025-10-03):
119
- - Fixed 15 flaky tests across 3 files
120
- - Pass rate: 60% → 100%
121
- - Execution time: 40% faster
122
- - No more race conditions
@@ -1,20 +0,0 @@
1
- ---
2
- name: debug
3
- description: Debug issue [issue]
4
- usage: /debug <issue-description>
5
- argument-hint: [description of the problem]
6
- ---
7
- Debug: $ARGUMENTS
8
-
9
- ## Process
10
- 1. Clarify: What's expected vs actual behavior?
11
- 2. Reproduce: What triggers the issue?
12
- 3. Isolate: Which component/function is responsible?
13
- 4. Trace: Follow the data flow
14
- 5. Fix: Implement and verify the solution
15
-
16
- ## Output
17
- - Root cause
18
- - Affected code paths
19
- - Fix with explanation
20
- - Prevention strategy
@@ -1,18 +0,0 @@
1
- ---
2
- name: explain
3
- description: Explain [code]
4
- usage: /explain <code-section>
5
- argument-hint: [file, function, or concept]
6
- model: claude-3-5-haiku-20241022
7
- ---
8
- Explain $ARGUMENTS.
9
-
10
- ## Cover
11
- - What it does (purpose)
12
- - How it works (step by step)
13
- - Why it's designed this way
14
- - Dependencies and side effects
15
- - Potential gotchas
16
-
17
- Assume reader knows the language but not this codebase.
18
-
@@ -1,139 +0,0 @@
1
- ---
2
- name: friction
3
- description: Analyze session behavior patterns
4
- usage: /friction <sessions-path>
5
- argument-hint: <sessions-path>
6
- ---
7
-
8
- Analyze Claude Code session logs for friction signals, behavioral patterns, and failure antigens.
9
-
10
- **Guardrails**
11
- - Favor straightforward, minimal implementations first and add complexity only when requested or clearly required.
12
- - Keep changes tightly scoped to the requested outcome.
13
-
14
- **Argument: sessions-path (required)**
15
-
16
- Path to the Droid sessions directory containing JSONL files.
17
- - Example: `/friction ~/.factory/projects/-home-hamr-PycharmProjects-aurora/`
18
- - If no argument provided, ask the user for the path. Do NOT guess.
19
-
20
- **What it does**
21
-
22
- Runs friction analysis on session JSONL files and writes results to `.factory/friction/` in the current project.
23
-
24
- **Steps**
25
-
26
- 1. **Validate path**
27
- - The argument `$ARGUMENTS` is the sessions path
28
- - Verify the path exists and contains `.jsonl` files
29
- - If path doesn't exist or has no JSONL files, tell the user and stop
30
- - Count total session files found
31
-
32
- 2. **Run friction.js** (bundled at `commands/friction/friction.js`)
33
- - Look for friction.js in order:
34
- 1. `~/.factory/commands/friction/friction.js` (installed)
35
- 2. `packages/droid/commands/friction/friction.js` (package development)
36
- - If found, run: `node <path-to-friction.js> "$ARGUMENTS"`
37
- - If it does NOT exist anywhere, fall back to running the analysis manually (step 3)
38
- - If friction.js succeeds, skip to step 7
39
-
40
- 3. **Manual analysis fallback** (only if friction.js not available)
41
- - For each `.jsonl` session file in the path:
42
- - Read the file
43
- - Extract signals using these patterns:
44
-
45
- | Signal | Weight | How to detect |
46
- |---|---|---|
47
- | `user_intervention` | 10 | User message contains `/stash` |
48
- | `session_abandoned` | 10 | Last 3 turns have friction > 15 and no `exit_success` |
49
- | `false_success` | 8 | LLM text contains "done"/"complete"/"fixed" AND next tool result has error |
50
- | `no_resolution` | 8 | Session has `exit_error` signals but no `exit_success` after them |
51
- | `tool_loop` | 6 | Same tool called 3+ times with identical arguments |
52
- | `rapid_exit` | 6 | <3 turns AND ends with error |
53
- | `interrupt_cascade` | 5 | Multiple `request_interrupted` within 60 seconds |
54
- | `user_curse` | 5 | User message matches profanity patterns |
55
- | `request_interrupted` | 2.5 | Turn has `is_interrupted: true` or ESC/Ctrl+C signal |
56
- | `exit_error` | 1 | Tool result has non-zero exit code |
57
- | `repeated_question` | 1 | User asks same question twice (fuzzy match) |
58
- | `long_silence` | 0.5 | >10 minute gap between turns |
59
- | `user_negation` | 0.5 | User message starts with "no", "wrong", "didn't work" |
60
- | `compaction` | 0.5 | System message indicates context compaction |
61
-
62
- 4. **Score each session**
63
- - Accumulate weighted signal scores (no subtraction, only accumulation)
64
- - Track peak friction score
65
- - Classify session quality:
66
- - **BAD**: has `user_intervention` or `session_abandoned`
67
- - **FRICTION**: has `user_curse` or `false_success`
68
- - **ROUGH**: peak friction >= 15, no intervention
69
- - **OK**: low friction, completed normally
70
- - **ONE-SHOT**: single turn, not interactive (filter out)
71
-
72
- 5. **Aggregate stats**
73
- - Count sessions by quality
74
- - Calculate BAD rate
75
- - Identify worst and best sessions
76
- - Daily trend if sessions span multiple days
77
-
78
- 6. **Extract antigen candidates from BAD sessions**
79
- - For each BAD session, extract:
80
- - Anchor signal (what triggered BAD classification)
81
- - Tool sequence around the failure
82
- - Error messages
83
- - Pattern description
84
- - Write as antigen candidates
85
-
86
- 7. **Write output to `.factory/friction/`**
87
- - Create `.factory/friction/` directory if it doesn't exist
88
- - Write these files:
89
- - `friction_analysis.json` — per-session breakdown (quality, peak, signals)
90
- - `friction_summary.json` — aggregate stats, verdict, daily trend
91
- - `friction_raw.jsonl` — all raw signals with timestamps
92
- - `antigen_candidates.json` — raw extracted failure patterns
93
- - `antigen_clusters.json` — clustered patterns (primary artifact for /remember)
94
- - `antigen_review.md` — human-readable clustered review
95
-
96
- 8. **Report to user**
97
- - Sessions analyzed count
98
- - BAD / FRICTION / ROUGH / OK counts
99
- - BAD rate percentage
100
- - Worst session ID and peak friction
101
- - Path to `antigen_review.md` for review
102
- - Remind: run `/remember` to consolidate into project memory
103
-
104
- **Output format for antigen_review.md**
105
-
106
- ```markdown
107
- # Friction Antigen Clusters
108
-
109
- Generated: [date]
110
- BAD sessions: [count] | Raw candidates: [count] | Clusters: [count]
111
-
112
- ## Cluster Summary
113
-
114
- | # | Signal | Tool Pattern | Count | Sessions | Score | Median Peak |
115
- |---|--------|-------------|-------|----------|-------|-------------|
116
- | 1 | false_success | Bash,Bash | 35 | 23 | 280 | 73 |
117
- | 2 | user_intervention | (none) | 34 | 24 | 340 | 65 |
118
-
119
- ## Cluster 1: false_success | Bash,Bash
120
-
121
- **Occurrences:** 35 across 23 sessions | **Score:** 280
122
-
123
- ### User Context (what the user said)
124
- > [actual user quote from session]
125
-
126
- ### Errors
127
- [error messages if any]
128
-
129
- ### Files involved
130
- - [file paths]
131
- ```
132
-
133
- **File locations**
134
- - Design doc: `docs/02-features/memory/LONG_TERM_MEMORY.md`
135
- - Input: JSONL session files from `$ARGUMENTS` path
136
- - Output: `.factory/friction/` (project-local)
137
- - JS script: `commands/friction/friction.js` (bundled alongside this command)
138
- - Python equivalent: `scripts/friction.py` (aurora users, same logic)
139
- - Manual fallback: built into this command if friction.js unavailable
@@ -1,14 +0,0 @@
1
- ---
2
- name: git-commit
3
- description: Analyze changes and commit
4
- usage: /git-commit
5
- allowed-tools: Bash(git *)
6
- ---
7
- 1. Run `git diff --staged` to see changes
8
- 2. Analyze what was changed and why
9
- 3. Create a commit message:
10
- - Format: type(scope): description
11
- - Types: feat, fix, refactor, docs, test, chore
12
- - Under 72 chars
13
- - Body explains WHY if non-obvious
14
- 4. Execute the commit
@@ -1,18 +0,0 @@
1
- ---
2
- name: review
3
- description: Review code [file]
4
- usage: /review
5
- argument-hint: [file or leave empty for staged changes]
6
- ---
7
- Review $ARGUMENTS (or staged changes if not specified).
8
-
9
- ## Check For
10
- - Security: OWASP Top 10, auth issues, data exposure
11
- - Performance: N+1 queries, memory leaks, blocking calls
12
- - Correctness: Edge cases, error handling, type safety
13
- - Maintainability: Complexity, naming, duplication
14
-
15
- ## Output Format
16
- ### 🚨 Critical (blocks merge)
17
- ### ⚠️ Warnings (should fix)
18
- ### 💡 Suggestions (nice to have)
@@ -1,107 +0,0 @@
1
- ---
2
- name: code-review
3
- description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements - reviews implementation against plan or requirements before proceeding
4
- usage: /code-review <review-scope> <focus-areas>
5
- auto_trigger: false
6
- ---
7
-
8
- # Requesting Code Review
9
-
10
- Review code thoroughly to catch issues before they cascade.
11
-
12
- **Core principle:** Review early, review often.
13
-
14
- ## When to Request Review
15
-
16
- **Mandatory:**
17
- - After each task in subagent-driven development
18
- - After completing major feature
19
- - Before merge to main
20
-
21
- **Optional but valuable:**
22
- - When stuck (fresh perspective)
23
- - Before refactoring (baseline check)
24
- - After fixing complex bug
25
-
26
- ## How to Request
27
-
28
- **1. Get git SHAs:**
29
- ```bash
30
- BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
31
- HEAD_SHA=$(git rev-parse HEAD)
32
- ```
33
-
34
- **2. Conduct code review:**
35
-
36
- Review implementation against requirements and plan
37
-
38
- **Placeholders:**
39
- - `{WHAT_WAS_IMPLEMENTED}` - What you just built
40
- - `{PLAN_OR_REQUIREMENTS}` - What it should do
41
- - `{BASE_SHA}` - Starting commit
42
- - `{HEAD_SHA}` - Ending commit
43
- - `{DESCRIPTION}` - Brief summary
44
-
45
- **3. Act on feedback:**
46
- - Fix Critical issues immediately
47
- - Fix Important issues before proceeding
48
- - Note Minor issues for later
49
- - Push back if reviewer is wrong (with reasoning)
50
-
51
- ## Example
52
-
53
- ```
54
- [Just completed Task 2: Add verification function]
55
-
56
- You: Let me request code review before proceeding.
57
-
58
- BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
59
- HEAD_SHA=$(git rev-parse HEAD)
60
-
61
- [Conduct code review]
62
- WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
63
- PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
64
- BASE_SHA: a7981ec
65
- HEAD_SHA: 3df7661
66
- DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
67
-
68
- [Subagent returns]:
69
- Strengths: Clean architecture, real tests
70
- Issues:
71
- Important: Missing progress indicators
72
- Minor: Magic number (100) for reporting interval
73
- Assessment: Ready to proceed
74
-
75
- You: [Fix progress indicators]
76
- [Continue to Task 3]
77
- ```
78
-
79
- ## Integration with Workflows
80
-
81
- **Subagent-Driven Development:**
82
- - Review after EACH task
83
- - Catch issues before they compound
84
- - Fix before moving to next task
85
-
86
- **Executing Plans:**
87
- - Review after each batch (3 tasks)
88
- - Get feedback, apply, continue
89
-
90
- **Ad-Hoc Development:**
91
- - Review before merge
92
- - Review when stuck
93
-
94
- ## Red Flags
95
-
96
- **Never:**
97
- - Skip review because "it's simple"
98
- - Ignore Critical issues
99
- - Proceed with unfixed Important issues
100
- - Argue with valid technical feedback
101
-
102
- **If reviewer wrong:**
103
- - Push back with technical reasoning
104
- - Show code/tests that prove it works
105
- - Request clarification
106
-
107
- See template at: requesting-code-review/code-reviewer.md