liteagents 2.9.0 → 2.10.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.
- package/CHANGELOG.md +33 -0
- package/README.md +25 -31
- package/installer/cli.js +6 -2
- package/package.json +3 -3
- package/packages/ampcode/AGENT.md +9 -15
- package/packages/ampcode/agents/code-developer.md +11 -12
- package/packages/ampcode/agents/quality-assurance.md +1 -1
- package/packages/{droid/commands/systematic-debugging.md → ampcode/commands/debug-method.md} +9 -9
- package/packages/ampcode/commands/diff-review.md +78 -0
- package/packages/ampcode/commands/friction/friction.js +28 -6
- package/packages/ampcode/commands/optimize.md +45 -4
- package/packages/ampcode/commands/refactor.md +33 -1
- package/packages/ampcode/commands/remember.md +34 -3
- package/packages/ampcode/commands/security.md +28 -1
- package/packages/ampcode/commands/stash.md +7 -0
- package/packages/{droid/commands/test-driven-development.md → ampcode/commands/tdd-flow.md} +2 -2
- package/packages/ampcode/commands/test-generate.md +64 -15
- package/packages/{opencode/command/testing-anti-patterns.md → ampcode/commands/test-traps.md} +77 -3
- package/packages/{droid/commands/root-cause-tracing.md → ampcode/commands/trace-back.md} +3 -3
- package/packages/ampcode/commands/{verification-before-completion.md → verify-done.md} +3 -3
- package/packages/claude/CLAUDE.md +9 -15
- package/packages/claude/agents/code-developer.md +11 -12
- package/packages/claude/agents/quality-assurance.md +1 -1
- package/packages/claude/commands/diff-review.md +78 -0
- package/packages/claude/commands/friction/friction.js +28 -6
- package/packages/claude/commands/optimize.md +45 -4
- package/packages/claude/commands/refactor.md +33 -1
- package/packages/claude/commands/remember.md +34 -3
- package/packages/claude/commands/security.md +28 -1
- package/packages/claude/commands/stash.md +7 -0
- package/packages/claude/commands/test-generate.md +64 -15
- package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package-lock.json +3 -3
- package/packages/claude/skills/{systematic-debugging → debug-method}/CREATION-LOG.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/SKILL.md +9 -9
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-academic.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-1.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-2.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-3.md +1 -1
- package/packages/claude/skills/{test-driven-development → tdd-flow}/SKILL.md +3 -3
- package/packages/claude/skills/{testing-anti-patterns → test-traps}/SKILL.md +77 -3
- package/packages/claude/skills/{root-cause-tracing → trace-back}/SKILL.md +3 -3
- package/packages/claude/skills/{verification-before-completion → verify-done}/SKILL.md +3 -3
- package/packages/droid/AGENTS.md +8 -14
- package/packages/{opencode/command/systematic-debugging.md → droid/commands/debug-method.md} +9 -9
- package/packages/droid/commands/diff-review.md +78 -0
- package/packages/droid/commands/friction/friction.js +28 -6
- package/packages/droid/commands/optimize.md +45 -4
- package/packages/droid/commands/refactor.md +33 -1
- package/packages/droid/commands/remember.md +34 -3
- package/packages/droid/commands/security.md +28 -1
- package/packages/droid/commands/stash.md +7 -0
- package/packages/{opencode/command/test-driven-development.md → droid/commands/tdd-flow.md} +2 -2
- package/packages/droid/commands/test-generate.md +64 -15
- package/packages/droid/commands/{testing-anti-patterns.md → test-traps.md} +77 -3
- package/packages/{opencode/command/root-cause-tracing.md → droid/commands/trace-back.md} +3 -3
- package/packages/droid/commands/{verification-before-completion.md → verify-done.md} +3 -3
- package/packages/droid/droids/code-developer.md +11 -12
- package/packages/droid/droids/quality-assurance.md +1 -1
- package/packages/opencode/AGENTS.md +8 -14
- package/packages/opencode/agent/code-developer.md +11 -12
- package/packages/opencode/agent/quality-assurance.md +1 -1
- package/packages/{ampcode/commands/systematic-debugging.md → opencode/command/debug-method.md} +9 -9
- package/packages/opencode/command/diff-review.md +78 -0
- package/packages/opencode/command/friction/friction.js +28 -6
- package/packages/opencode/command/optimize.md +45 -4
- package/packages/opencode/command/refactor.md +33 -1
- package/packages/opencode/command/remember.md +34 -3
- package/packages/opencode/command/security.md +28 -1
- package/packages/opencode/command/stash.md +7 -0
- package/packages/{ampcode/commands/test-driven-development.md → opencode/command/tdd-flow.md} +2 -2
- package/packages/opencode/command/test-generate.md +64 -15
- package/packages/{ampcode/commands/testing-anti-patterns.md → opencode/command/test-traps.md} +77 -3
- package/packages/{ampcode/commands/root-cause-tracing.md → opencode/command/trace-back.md} +3 -3
- package/packages/opencode/command/{verification-before-completion.md → verify-done.md} +3 -3
- package/packages/opencode/opencode.jsonc +13 -37
- package/packages/subagentic-manual.md +55 -51
- package/packages/ampcode/commands/code-review.md +0 -107
- package/packages/ampcode/commands/condition-based-waiting.md +0 -122
- package/packages/ampcode/commands/debug.md +0 -20
- package/packages/ampcode/commands/explain.md +0 -18
- package/packages/ampcode/commands/friction.md +0 -139
- package/packages/ampcode/commands/git-commit.md +0 -14
- package/packages/ampcode/commands/review.md +0 -18
- package/packages/claude/commands/debug.md +0 -20
- package/packages/claude/commands/explain.md +0 -18
- package/packages/claude/commands/friction.md +0 -139
- package/packages/claude/commands/git-commit.md +0 -14
- package/packages/claude/commands/review.md +0 -18
- package/packages/claude/skills/code-review/SKILL.md +0 -107
- package/packages/claude/skills/code-review/code-reviewer.md +0 -146
- package/packages/claude/skills/condition-based-waiting/SKILL.md +0 -122
- package/packages/droid/commands/code-review.md +0 -107
- package/packages/droid/commands/condition-based-waiting.md +0 -122
- package/packages/droid/commands/debug.md +0 -20
- package/packages/droid/commands/explain.md +0 -18
- package/packages/droid/commands/friction.md +0 -139
- package/packages/droid/commands/git-commit.md +0 -14
- package/packages/droid/commands/review.md +0 -18
- package/packages/opencode/command/code-review.md +0 -107
- package/packages/opencode/command/condition-based-waiting.md +0 -122
- package/packages/opencode/command/debug.md +0 -20
- package/packages/opencode/command/explain.md +0 -18
- package/packages/opencode/command/friction.md +0 -139
- package/packages/opencode/command/git-commit.md +0 -14
- package/packages/opencode/command/review.md +0 -18
- /package/packages/ampcode/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/ampcode/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
- /package/packages/claude/skills/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/claude/skills/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
- /package/packages/droid/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/droid/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
- /package/packages/opencode/command/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/opencode/command/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
+
## [2.10.0] - 2026-06-16
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- **`/friction` collapsed into `/remember`; the hot-memory pipeline is now two commands (`/stash → /remember`), down from three.** `/remember` now runs `friction.js` itself as a best-effort first step before consolidating — so the antigen data is always fresh and friction can't be forgotten. Friction targets the tool's **global sessions root** (all projects, since behavioral patterns are cross-project), resolved from an editable, never-prompt probe list baked into `remember.md` (Claude Code, Droid/Factory, Amp, opencode, plus Codex and Antigravity roots; add your own at the top). A no-sessions miss is surfaced **loudly** and degrades to stash-only — never a silent skip. The standalone `/friction` command was removed across all four packages (the `friction.js` script stays, directly runnable for inspection). Counts: claude commands 9→8, droid/opencode/ampcode 17 each.
|
|
24
|
+
- **`/stash` now nudges toward consolidation.** After saving, it derives the unprocessed backlog (`stash files − .processed manifest entries`) and, at ≥5, emits a one-line prompt to run `/remember`. No counter is stored — the count is derived from ground truth, and running `/remember` clears it. The nudge is informational; `/remember` never runs automatically.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- **`friction.js` no longer crashes on a single malformed JSONL line.** The four mirrored copies parsed session logs and `friction_raw.jsonl` with bare `.map(line => JSON.parse(line))` — one corrupt line aborted the whole run. A new `parseJsonl(raw, source)` helper skips bad lines with a one-line stderr warning (line number + source) and keeps the good records; the whole-file `friction_analysis.json` read is now wrapped in a try/catch that reports the file and bails with exit 1 instead of throwing. Mirrored identically (modulo `.claude`/`.factory`/`.opencode`/`.amp` branding) across all four tool packages.
|
|
28
|
+
- **`packages/subagentic-manual.md` restored after a range-sed corrupted ~310 lines.** A `sed '/start/,/end/{s/.../...}'` earlier this session had `test-generate$` as the end pattern; the range matched far past its intended scope (later occurrences in tree diagrams and category bullets), overwriting the entire tail of the document — Subagents reference, Commands reference, Hot Memory, Usage Patterns, Platform Architecture, Frontmatter Architecture, Contributing — with ~310 duplicate copies of the "Simple Commands" bullet. Restored from the pre-corruption snapshot and re-applied all the renames + count updates that should have happened cleanly. Same fix mirrored to `agentic-toolkit/ai/subagentic/subagentic-manual.md`.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- **Root `package.json` `engines.node` bumped `>=14.0.0` → `>=18.0.0`.** Node 14 has been EOL since 2023-04; the floor now matches the bundled `live-canvas-channel` plugin (`>=18`) and sits well under what CI publishes on (Node 22). As a minimum it excludes no one currently on a supported runtime.
|
|
32
|
+
- **`/review` renamed to `/diff-review` across all four tool packages.** Avoids the name collision with the Anthropic-official `code-review` plugin (which also ships a skill named `review` that operates on PRs). `/diff-review` is more accurate to what the command does — it operates on a diff (staged, working tree, branch range, or against a ref), not on a remote PR. Mirrored into `~/.claude/commands/` and all docs/agents/`opencode.jsonc` references swept.
|
|
33
|
+
- **`/diff-review` absorbed `/code-review`; collapsed to a single command across all four tool packages.** `/diff-review` now accepts a file, a branch (`/diff-review main` diffs `merge-base(main, HEAD)..HEAD` — the common "review my branch before merging" path), or an explicit range (`main..HEAD`). It bakes in the user's standing review focus: bugs needing a fix, dead code, loose ends (added TODO/FIXME, swallowed errors, stubs, abandoned flags), correctness, security, performance, maintainability.
|
|
34
|
+
- **`/diff-review` and `/security` now verify findings, selectively auto-fix, and stop to ask only when needed.** After listing findings, each cited `file:line` is re-grounded in context (and `git grep`'d for dead-code claims) and marked confirmed / false-positive / uncertain. Confirmed + unambiguous + no-contract-change fixes apply directly; the changed region is re-read after the edit. HITL gates fire only for: uncertain findings, multiple reasonable fix shapes, downstream-affecting changes (signatures / response shape / schema / public symbol removal), security primitives (auth / crypto / session / token), or "dead code" that looks intentionally kept. `/diff-review` ends with a one-line **Ready to merge? Yes / No / With fixes** verdict.
|
|
35
|
+
- **Skills renamed to short 2-word slugs (round 2).** `testing-anti-patterns` → **`test-traps`** (now includes timing/polling as AP6 after the fold). `test-driven-development` → **`tdd-flow`** (slug short, H1 short, `TDD` prose preserved as the industry term). `verification-before-completion` → **`verify-done`** (rhythmically mirrors `test-first`). Round 2 paired with round 1 (`systematic-debugging` → `debug-method`, `root-cause-tracing` → `trace-back`) gives a scannable cluster: `tdd-flow / test-generate / test-traps` and `debug-method / trace-back / verify-done`. All references swept across docs, agent files, opencode.jsonc, and the debug-method skill's cross-refs.
|
|
36
|
+
- **Skills renamed to short 2-word slugs (round 1).** `systematic-debugging` → **`debug-method`** (the 4-phase framework with its 4 pressure-test scenarios + creation log preserved). `root-cause-tracing` → **`trace-back`** (the backward-tracing technique with its `find-polluter.sh` bisection helper preserved). Names are shorter, cluster alphabetically under `debug-`, and the "method vs technique" split is now obvious at a glance. All references swept across docs, agent files, and the debug-method skill's internal cross-refs to trace-back.
|
|
37
|
+
- **`/test-generate` rewritten as a generate-and-verify loop, not just a generator.** New flow: discover the existing test framework (refuses to add a new runner) → mirror nearby tests for style/fixtures → generate happy / edge / error cases → **run the new tests** with the project's real test command → **verify each test bites** (mentally swap a broken impl — does the assertion catch it?). Superficial tests (`expect(true).toBe(true)`, mock-asserting-itself, setup-masked passes) count as a failure to ship. Same claim → verify → report shape as `/diff-review` and `/security`. HITL gates: a meaningful test would require a non-obvious design change in production code, ambiguous existing test patterns, or a mock style the project doesn't currently use.
|
|
38
|
+
- **`/optimize` now verifies bottleneck claims before optimizing.** Each cited `file:line` must have at least one of: a profile / benchmark / log line showing call frequency or duration, an obvious hot loop / per-request handler, or user-provided evidence. Unverified claims are marked **uncertain — don't optimize on speculation**. Auto-fixes only when confirmed + unambiguous + no behavior/API change. HITL gates: uncertain (no profile), multiple reasonable shapes (cache vs precompute vs batch vs paginate vs index), public-API / response / schema changes, correctness-for-speed trades, or concurrency primitives.
|
|
39
|
+
- **`/refactor` now runs the tests after the edit.** The "existing tests must pass" constraint was load-bearing but unverified — `/refactor` now detects the project's test command (`package.json` scripts, `pytest`, `go test`, `cargo test`, `Makefile`), runs it scoped to the affected area when possible, and reports pass/fail. If tests fail it **stops and asks** with three options (revert / patch the refactor / update the test with reasoning) rather than auto-reverting (destroys work) or pushing forward (breaks the invariant). Also stops on scope creep and public-API-boundary changes.
|
|
40
|
+
- **`condition-based-waiting` folded into `test-traps` as Anti-Pattern 6: Timeout-Based Waiting.** The two skills covered the same domain (test quality) but only one auto-triggered; folding promotes the timing/polling guidance to auto-trigger coverage. The `example.ts` helper (domain-specific `waitForEvent` / `waitForEventCount` / `waitForEventMatch`) moves with it and is referenced from AP6. Counts: claude skills 10 → 9; droid/opencode/ampcode commands 19 → 18.
|
|
41
|
+
- **CI:** the publish workflow now polls the npm registry for ~2 min (was ~15s; `--prefer-online` skips npm's view cache) and accepts an `exit 0` publish even if the registry hasn't reflected it yet, so a successful-but-slow-to-reflect publish no longer reports a false failure.
|
|
42
|
+
- **`publish.yml` is now manual-only (`workflow_dispatch`) — npm OIDC trusted publishing with provenance, idempotent, and verifies the registry end-state.**
|
|
43
|
+
- **`publish.yml` install step `npm ci` → `npm install`.** This toolkit is dependency-free (no `package-lock.json`), so `npm ci` failed with `EUSAGE`; `npm install` is a fast no-op here and still works if deps are ever added. Removed the superseded manual `scripts/publish.sh` (NPM_TOKEN-via-`pass` flow) — publishing now goes solely through the `publish.yml` GitHub Actions workflow.
|
|
44
|
+
|
|
45
|
+
### Removed
|
|
46
|
+
- `/code-review` (was: workflow ceremony about *when* to request a review, mostly overlapping `/diff-review`'s purpose). Use `/diff-review` instead — `/diff-review main` for branch-vs-main, `/diff-review` with no args for staged/working-tree.
|
|
47
|
+
- **`/debug`** — was a thin 17-line echo of the `systematic-debugging` skill. The skill (now `debug-method`) carries the real workflow with its pressure-test scenarios; the command added nothing.
|
|
48
|
+
- **`/explain`** — was 11 lines of "explain this code" with no real constraints or workflow. The model does this naturally from a plain prompt.
|
|
49
|
+
- **`/git-commit`** — Claude Code has built-in commit handling and the other three tools don't need a thin wrapper around `git diff --staged` + a templated message either. Use natural-language prompts instead.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
20
53
|
## [2.9.0] - 2026-05-26
|
|
21
54
|
|
|
22
55
|
Redesign of the `/friction` → `/remember` memory pipeline so friction stops poisoning hot memory and antigens come from what the user actually said. Applied identically across all four tool packages (claude, opencode, ampcode, droid).
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
╚══════╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
**AI development toolkit with 11 specialized agents and
|
|
12
|
+
**AI development toolkit with 11 specialized agents and 17 commands per tool**
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
15
|
<img src="https://img.shields.io/github/package-json/v/hamr0/liteagents?label=version&color=2a4f8c" alt="version (auto from package.json)">
|
|
@@ -45,10 +45,10 @@ liteagents
|
|
|
45
45
|
|
|
46
46
|
### Supported Tools
|
|
47
47
|
|
|
48
|
-
- **Claude Code** - 11 subagents +
|
|
49
|
-
- **Opencode** - 11 agent references +
|
|
50
|
-
- **Ampcode** - 11 subagents +
|
|
51
|
-
- **Droid** - 11 agent references +
|
|
48
|
+
- **Claude Code** - 11 subagents + 9 skills + 8 commands (+ optional live-canvas channel plugin)
|
|
49
|
+
- **Opencode** - 11 agent references + 17 commands
|
|
50
|
+
- **Ampcode** - 11 subagents + 17 commands
|
|
51
|
+
- **Droid** - 11 agent references + 17 commands
|
|
52
52
|
|
|
53
53
|
**Key Difference:**
|
|
54
54
|
- **Claude Code**: Full subagent system with orchestrator + skills (auto-triggering)
|
|
@@ -61,30 +61,29 @@ liteagents
|
|
|
61
61
|
@orchestrator help
|
|
62
62
|
@1-create-prd Create a PRD for a task management app
|
|
63
63
|
/brainstorming Explore authentication approaches
|
|
64
|
-
/
|
|
64
|
+
/tdd-flow Implement user login
|
|
65
65
|
|
|
66
66
|
# Opencode/Ampcode/Droid examples
|
|
67
67
|
/1-create-prd Create a PRD for a task management app
|
|
68
68
|
/brainstorming Explore authentication approaches
|
|
69
|
-
/
|
|
69
|
+
/tdd-flow Implement user login
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
---
|
|
73
73
|
|
|
74
74
|
## Hot Memory — project-local learning from your own sessions
|
|
75
75
|
|
|
76
|
-
Liteagents ships a
|
|
76
|
+
Liteagents ships a two-command pipeline that turns Claude Code's session logs into project-local memory. No databases, no external services, just markdown files the assistant reads via `@MEMORY.md`.
|
|
77
77
|
|
|
78
78
|
```
|
|
79
|
-
/stash → /
|
|
80
|
-
capture analyze
|
|
79
|
+
/stash → /remember
|
|
80
|
+
capture analyze + consolidate
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
- **`/stash`** — snapshot the current session's context before compaction or handoff
|
|
84
|
-
- **`/
|
|
85
|
-
- **`/remember`** — consolidate stashes + friction antigens into `.claude/memory/MEMORY.md`; auto-injected into `CLAUDE.md` via `@MEMORY.md` so every future session in the project benefits
|
|
83
|
+
- **`/stash`** — snapshot the current session's context before compaction or handoff; nudges you to consolidate once a few stashes pile up
|
|
84
|
+
- **`/remember`** — runs friction analysis automatically (mining JSONL session logs across *all* your projects for frustration signals, failed flows, and abandonment patterns, clustered into antigen candidates), then consolidates stashes + friction antigens into `.claude/memory/MEMORY.md`; auto-injected into `CLAUDE.md` via `@MEMORY.md` so every future session benefits
|
|
86
85
|
|
|
87
|
-
What you get is a memory that *learns from your own mistakes and interventions*, grows quietly in your repo, and works anywhere Claude Code runs. The friction
|
|
86
|
+
What you get is a memory that *learns from your own mistakes and interventions*, grows quietly in your repo, and works anywhere Claude Code runs. The friction pass inside `/remember` scans all your projects and gives you a per-repo reliability verdict:
|
|
88
87
|
|
|
89
88
|
```
|
|
90
89
|
Per-Project:
|
|
@@ -98,7 +97,7 @@ BEST: web-client/0202-2121-8d8608e1 peak=0 turns=4
|
|
|
98
97
|
Verdict: USEFUL Intervention predictability: 93%
|
|
99
98
|
```
|
|
100
99
|
|
|
101
|
-
Results land in `.claude/friction/antigen_review.md` with projects, error patterns, and offending tool sequences called out per cluster —
|
|
100
|
+
Results land in `.claude/friction/antigen_review.md` with projects, error patterns, and offending tool sequences called out per cluster — which `/remember` then encodes as rules the next session sees.
|
|
102
101
|
|
|
103
102
|
> This is the thing in liteagents that nothing else ships. Normal skill bundles give you instructions. The hot-memory pipeline gives you instructions the assistant wrote for itself, from your own logs.
|
|
104
103
|
|
|
@@ -123,14 +122,14 @@ Results land in `.claude/friction/antigen_review.md` with projects, error patter
|
|
|
123
122
|
- **system-architect** - System design, technology selection, API design, scalability planning
|
|
124
123
|
- **ui-designer** - UI/UX design, wireframes, prototypes, accessibility, design systems
|
|
125
124
|
|
|
126
|
-
###
|
|
125
|
+
### 18 Commands/Skills
|
|
127
126
|
|
|
128
127
|
**Auto-Triggering Skills (3)** - Claude Code only:
|
|
129
|
-
- **
|
|
130
|
-
- **
|
|
131
|
-
- **
|
|
128
|
+
- **tdd-flow** - Write test first, watch fail, minimal passing code
|
|
129
|
+
- **test-traps** - Prevent mocking anti-patterns
|
|
130
|
+
- **verify-done** - Verify before claiming done
|
|
132
131
|
|
|
133
|
-
**Manual Skills/Commands (
|
|
132
|
+
**Manual Skills/Commands (15):**
|
|
134
133
|
|
|
135
134
|
*Hot Memory Pipeline (3)* — see the [Hot Memory](#hot-memory--project-local-learning-from-your-own-sessions) section above for the full walkthrough:
|
|
136
135
|
- **stash** - Snapshot session context to `.claude/stash/` before compaction, handoff, or ending complex work
|
|
@@ -142,19 +141,14 @@ Results land in `.claude/friction/antigen_review.md` with projects, error patter
|
|
|
142
141
|
|
|
143
142
|
*Workflow & analysis*:
|
|
144
143
|
- **brainstorming** - Structured brainstorming sessions
|
|
145
|
-
- **code-review** - Implementation review against requirements
|
|
146
|
-
- **condition-based-waiting** - Replace timeouts with condition polling
|
|
147
144
|
- **docs-builder** - Project documentation generation
|
|
148
|
-
- **
|
|
145
|
+
- **trace-back** - Trace bugs backward through call stack
|
|
149
146
|
- **skill-creator** - Guide for creating new skills
|
|
150
|
-
- **
|
|
151
|
-
- **debug** - Systematic issue investigation
|
|
152
|
-
- **explain** - Explain code for newcomers
|
|
153
|
-
- **git-commit** - Intelligent commit creation
|
|
147
|
+
- **debug-method** - Four-phase debugging framework
|
|
154
148
|
- **optimize** - Performance analysis
|
|
155
149
|
- **refactor** - Safe refactoring with behavior preservation
|
|
156
|
-
- **review** -
|
|
157
|
-
- **security** - Vulnerability
|
|
150
|
+
- **diff-review** - Review a file, branch, or range; verifies findings, fixes confirmed/unambiguous ones, asks on ambiguous or downstream-affecting ones
|
|
151
|
+
- **security** - Vulnerability scan; same verify→fix→ask flow as `/diff-review`
|
|
158
152
|
- **ship** - Pre-deployment checklist
|
|
159
153
|
- **test-generate** - Generate test suites
|
|
160
154
|
|
|
@@ -186,8 +180,8 @@ Results land in `.claude/friction/antigen_review.md` with projects, error patter
|
|
|
186
180
|
**Code Quality:**
|
|
187
181
|
```
|
|
188
182
|
@quality-assurance Review this PR before merge
|
|
189
|
-
/
|
|
190
|
-
/
|
|
183
|
+
/diff-review main # review branch vs main, fixes confirmed issues, asks on ambiguous ones
|
|
184
|
+
/debug-method Investigate this race condition
|
|
191
185
|
```
|
|
192
186
|
|
|
193
187
|
**Architecture & Design:**
|
package/installer/cli.js
CHANGED
|
@@ -15,7 +15,11 @@ const path = require('path');
|
|
|
15
15
|
const readline = require('readline');
|
|
16
16
|
|
|
17
17
|
// Single source of truth for version; UPDATE_VERSION.sh bumps only package.json.
|
|
18
|
-
const
|
|
18
|
+
const PACKAGE_JSON = require('../package.json');
|
|
19
|
+
const PACKAGE_VERSION = PACKAGE_JSON.version;
|
|
20
|
+
// Banner counts derived from the description field — same source as README.
|
|
21
|
+
const AGENT_COUNT = (PACKAGE_JSON.description.match(/(\d+)\s+specialized agents/) || [, '11'])[1];
|
|
22
|
+
const COMMAND_COUNT = (PACKAGE_JSON.description.match(/(\d+)\s+commands/) || [, '18'])[1];
|
|
19
23
|
|
|
20
24
|
// ANSI color codes
|
|
21
25
|
const colors = {
|
|
@@ -459,7 +463,7 @@ ${colors.bright}${colors.cyan}██╔══██║██║ ██║█
|
|
|
459
463
|
${colors.bright}${colors.cyan}██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║ ██║╚██████╗ ██║ ██╗██║ ██║${colors.reset}
|
|
460
464
|
${colors.bright}${colors.cyan}╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝${colors.reset}
|
|
461
465
|
|
|
462
|
-
${colors.bright}v${PACKAGE_VERSION} |
|
|
466
|
+
${colors.bright}v${PACKAGE_VERSION} | ${AGENT_COUNT} agents + ${COMMAND_COUNT} commands per tool${colors.reset}
|
|
463
467
|
`);
|
|
464
468
|
}
|
|
465
469
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "liteagents",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "AI development toolkit with 11 specialized agents and
|
|
3
|
+
"version": "2.10.0",
|
|
4
|
+
"description": "AI development toolkit with 11 specialized agents and 17 commands including live-canvas UI design with click-to-annotate feedback. Simple one-question installer for Claude, Opencode, Ampcode, and Droid.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"liteagents": "./installer/cli.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
62
|
+
"node": ">=18.0.0"
|
|
63
63
|
},
|
|
64
64
|
"files": [
|
|
65
65
|
"installer/",
|
|
@@ -22,38 +22,32 @@ These subagents are available when using Ampcode CLI.
|
|
|
22
22
|
| system-architect | Architect | Use for system design, architecture documents, technology selection, API design, and infrastructure planning |
|
|
23
23
|
| ui-designer | UX Expert | Use for UI/UX design, wireframes, prototypes, front-end specifications, and user experience optimization |
|
|
24
24
|
|
|
25
|
-
### Skills (
|
|
25
|
+
### Skills (9 total)
|
|
26
26
|
|
|
27
27
|
| ID | Description | Usage | Auto |
|
|
28
28
|
|---|---|---|---|
|
|
29
29
|
| brainstorming | Refines rough ideas into fully-formed designs through collaborative questioning | /brainstorming <session-type> <topic> | false |
|
|
30
|
-
| code-review | Reviews implementation against plan or requirements before proceeding | /code-review <review-scope> <focus-areas> | false |
|
|
31
|
-
| condition-based-waiting | Replaces arbitrary timeouts with condition polling to wait for actual state changes | /condition-based-waiting <condition-type> <timeout-specs> | false |
|
|
32
30
|
| docs-builder | Create comprehensive project documentation with structured /docs hierarchy | /docs-builder | false |
|
|
33
|
-
|
|
|
31
|
+
| trace-back | Systematically traces bugs backward through call stack to identify source | /trace-back <issue-description> | false |
|
|
34
32
|
| skill-creator | Guide for creating effective skills and extending Claude capabilities | /skill-creator <skill-type> <skill-description> | false |
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
33
|
+
| debug-method | Four-phase debugging framework - investigate root cause before any fixes | /debug-method <bug-or-error-description> | false |
|
|
34
|
+
| tdd-flow | Write test first, watch it fail, write minimal code to pass | /tdd-flow <feature-or-behavior-to-test> | true |
|
|
35
|
+
| test-traps | Prevents testing mock behavior and production pollution with test-only methods | /test-traps <testing-scenario> | true |
|
|
36
|
+
| verify-done | Requires running verification commands before making any success claims | /verify-done <work-to-verify> | true |
|
|
39
37
|
|
|
40
|
-
### Commands (
|
|
38
|
+
### Commands (8 total)
|
|
41
39
|
|
|
42
40
|
| ID | Description | Usage |
|
|
43
41
|
|---|---|---|
|
|
44
|
-
| debug | Debug an issue systematically using structured investigation techniques | /debug <issue-description> |
|
|
45
|
-
| explain | Explain code for someone new to the codebase | /explain <code-section> |
|
|
46
|
-
| friction | Analyze session logs for failure patterns and behavioral signals | /friction <sessions-path> |
|
|
47
|
-
| git-commit | Analyze changes and create intelligent git commits | /git-commit |
|
|
48
42
|
| live-canvas | Design UI variations and collect click-to-annotate feedback from the browser (batch mode only on Amp) | /live-canvas |
|
|
49
43
|
| optimize | Analyze and optimize performance issues | /optimize <target-area> |
|
|
50
44
|
| refactor | Refactor code while maintaining behavior and tests | /refactor <code-section> |
|
|
51
45
|
| remember | Consolidate stashes + friction into project memory | /remember |
|
|
52
|
-
| review | Comprehensive code review including quality, tests, and architecture | /review |
|
|
46
|
+
| diff-review | Comprehensive code review including quality, tests, and architecture | /diff-review |
|
|
53
47
|
| security | Security vulnerability scan and analysis | /security |
|
|
54
48
|
| ship | Pre-deployment verification checklist | /ship |
|
|
55
49
|
| stash | Save session context for compaction recovery or handoffs | /stash ["optional-name"] |
|
|
56
|
-
| test-generate | Generate
|
|
50
|
+
| test-generate | Generate tests, run them, verify each one actually exercises the code | /test-generate <file> |
|
|
57
51
|
|
|
58
52
|
All resources are auto-discovered from frontmatter in their respective directories:
|
|
59
53
|
- **Agents**: `./agents/*.md`
|
|
@@ -41,7 +41,7 @@ digraph CodeDeveloper {
|
|
|
41
41
|
context_discovery [label="Context Discovery\n(search related code,\ndeps, usages)", fillcolor=lightyellow];
|
|
42
42
|
|
|
43
43
|
// Debug path
|
|
44
|
-
use_debug [label="Use /
|
|
44
|
+
use_debug [label="Use /debug-method\nor /trace-back"];
|
|
45
45
|
|
|
46
46
|
// Refactor path
|
|
47
47
|
use_refactor [label="Use /refactor"];
|
|
@@ -54,12 +54,12 @@ digraph CodeDeveloper {
|
|
|
54
54
|
|
|
55
55
|
// Conditional testing
|
|
56
56
|
tdd_needed [label="TDD specified\nor tests needed?", shape=diamond];
|
|
57
|
-
use_tdd [label="Use /
|
|
57
|
+
use_tdd [label="Use /tdd-flow\nor /test-generate"];
|
|
58
58
|
|
|
59
59
|
// Validation
|
|
60
60
|
run_validations [label="Run validations\n(lint, build, tests)"];
|
|
61
61
|
validations_pass [label="Pass?", shape=diamond];
|
|
62
|
-
fix_issues [label="Fix issues\n(use /debug if needed)"];
|
|
62
|
+
fix_issues [label="Fix issues\n(use /debug-method if needed)"];
|
|
63
63
|
failure_count [label="3+ failures?", shape=diamond];
|
|
64
64
|
|
|
65
65
|
// Security check
|
|
@@ -75,8 +75,8 @@ digraph CodeDeveloper {
|
|
|
75
75
|
regression_fixable [label="Fixable?", shape=diamond];
|
|
76
76
|
|
|
77
77
|
// Review and complete
|
|
78
|
-
code_review [label="Run /
|
|
79
|
-
verification [label="Run /
|
|
78
|
+
code_review [label="Run /diff-review"];
|
|
79
|
+
verification [label="Run /verify-done", fillcolor=orange];
|
|
80
80
|
|
|
81
81
|
// Story-specific
|
|
82
82
|
update_story [label="Update story\n(checkbox, changelog)"];
|
|
@@ -184,15 +184,14 @@ All require `*` prefix. Invocation commands in table above. Additional:
|
|
|
184
184
|
|
|
185
185
|
| Situation | Delegate To |
|
|
186
186
|
|-----------|-------------|
|
|
187
|
-
| Bug encountered | `/
|
|
188
|
-
| Error deep in stack | `/
|
|
187
|
+
| Bug encountered | `/debug-method` (use `/trace-back` when the error is deep in the stack) |
|
|
188
|
+
| Error deep in stack | `/trace-back` |
|
|
189
189
|
| Refactoring code | `/refactor` |
|
|
190
|
-
| Need tests (when required) | `/test-generate` or `/
|
|
191
|
-
| Writing any test | `/
|
|
192
|
-
| Before completion | `/
|
|
190
|
+
| Need tests (when required) | `/test-generate` or `/tdd-flow` |
|
|
191
|
+
| Writing any test | `/test-traps` (avoid mocks, production pollution) |
|
|
192
|
+
| Before completion | `/verify-done` |
|
|
193
193
|
| After code changes | `/security` |
|
|
194
|
-
| Task complete
|
|
195
|
-
| General code review | `/review` (comprehensive quality check) |
|
|
194
|
+
| Task complete / general review | `/diff-review` (diffs branch or staged changes, verifies, fixes confirmed issues, asks on ambiguous ones) |
|
|
196
195
|
| Performance issues | `/optimize` |
|
|
197
196
|
|
|
198
197
|
You are an autonomous implementation specialist. Execute with precision, delegate appropriately, and communicate clearly when you need guidance or encounter blockers.
|
|
@@ -65,7 +65,7 @@ Before any analysis, read (if exists):
|
|
|
65
65
|
|
|
66
66
|
## Slash Commands Available
|
|
67
67
|
|
|
68
|
-
Use these during analysis: `/
|
|
68
|
+
Use these during analysis: `/diff-review`, `/security`, `/verify-done`
|
|
69
69
|
|
|
70
70
|
## Analysis Areas
|
|
71
71
|
|
package/packages/{droid/commands/systematic-debugging.md → ampcode/commands/debug-method.md}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: debug-method
|
|
3
3
|
description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes - four-phase framework (root cause investigation, pattern analysis, hypothesis testing, implementation) that ensures understanding before attempting solutions
|
|
4
|
-
usage: /
|
|
4
|
+
usage: /debug-method <bug-or-error-description>
|
|
5
5
|
auto_trigger: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Debug Method
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
@@ -113,7 +113,7 @@ You MUST complete each phase before proceeding to the next.
|
|
|
113
113
|
|
|
114
114
|
**WHEN error is deep in call stack:**
|
|
115
115
|
|
|
116
|
-
**REQUIRED SUB-SKILL:** Use
|
|
116
|
+
**REQUIRED SUB-SKILL:** Use trace-back for backward tracing technique
|
|
117
117
|
|
|
118
118
|
**Quick version:**
|
|
119
119
|
- Where does bad value originate?
|
|
@@ -178,7 +178,7 @@ You MUST complete each phase before proceeding to the next.
|
|
|
178
178
|
- Automated test if possible
|
|
179
179
|
- One-off test script if no framework
|
|
180
180
|
- MUST have before fixing
|
|
181
|
-
- **REQUIRED SUB-SKILL:** Use
|
|
181
|
+
- **REQUIRED SUB-SKILL:** Use tdd-flow for writing proper failing tests
|
|
182
182
|
|
|
183
183
|
2. **Implement Single Fix**
|
|
184
184
|
- Address the root cause identified
|
|
@@ -280,13 +280,13 @@ If systematic investigation reveals issue is truly environmental, timing-depende
|
|
|
280
280
|
## Integration with Other Skills
|
|
281
281
|
|
|
282
282
|
**This skill requires using:**
|
|
283
|
-
- **
|
|
284
|
-
- **
|
|
283
|
+
- **trace-back** - REQUIRED when error is deep in call stack (see Phase 1, Step 5)
|
|
284
|
+
- **tdd-flow** - REQUIRED for creating failing test case (see Phase 4, Step 1)
|
|
285
285
|
|
|
286
286
|
**Complementary skills:**
|
|
287
287
|
- **defense-in-depth** - Add validation at multiple layers after finding root cause
|
|
288
|
-
- **
|
|
289
|
-
- **
|
|
288
|
+
- **test-traps** (Anti-Pattern 6) - Replace arbitrary timeouts identified in Phase 2
|
|
289
|
+
- **verify-done** - Verify fix worked before claiming success
|
|
290
290
|
|
|
291
291
|
## Real-World Impact
|
|
292
292
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diff-review
|
|
3
|
+
description: Review diff [file, branch, or range]
|
|
4
|
+
usage: /diff-review
|
|
5
|
+
argument-hint: [file, branch (e.g. main), range (main..HEAD), or empty]
|
|
6
|
+
allowed-tools: Read, Edit, Grep, Glob, Bash(git diff *), Bash(git log *), Bash(git show *), Bash(git status *), Bash(git grep *), Bash(git rev-parse *), Bash(git merge-base *), Bash(rg *)
|
|
7
|
+
---
|
|
8
|
+
Review $ARGUMENTS. Interpret in this order:
|
|
9
|
+
1. **Empty** → staged diff (`git diff --staged`); if empty, working-tree diff
|
|
10
|
+
(`git diff`).
|
|
11
|
+
2. **A range** like `main..HEAD` or `origin/main...HEAD` → `git diff <range>`.
|
|
12
|
+
3. **A single ref** (branch / tag / SHA — confirm with `git rev-parse
|
|
13
|
+
--verify`) → diff that ref's merge-base against `HEAD` (i.e. everything on
|
|
14
|
+
the current branch since it diverged: `git diff $(git merge-base <ref>
|
|
15
|
+
HEAD)..HEAD`). This is the common "review my branch before merging" path.
|
|
16
|
+
4. **A file or directory path** → that target.
|
|
17
|
+
5. Otherwise → ask.
|
|
18
|
+
|
|
19
|
+
The diff is the subject; widen to surrounding code only as needed to judge a
|
|
20
|
+
hunk. For multi-commit ranges, also skim `git log <range>` to understand
|
|
21
|
+
intent before judging.
|
|
22
|
+
|
|
23
|
+
## Check For
|
|
24
|
+
- **Bugs needing a fix.** Logic errors, off-by-one, null/undefined paths,
|
|
25
|
+
races, wrong defaults, broken edge cases. Concrete failure modes only — not
|
|
26
|
+
vibes.
|
|
27
|
+
- **Dead code.** Unreferenced functions / vars / imports / params, unreachable
|
|
28
|
+
branches, commented-out blocks, legacy paths the diff just obsoleted.
|
|
29
|
+
`git grep` the symbol before flagging — easy to be wrong.
|
|
30
|
+
- **Loose ends.** TODO / FIXME / XXX added by this diff, half-finished
|
|
31
|
+
branches, silently swallowed errors, stub bodies, mocked-out paths,
|
|
32
|
+
"temporary" names, abandoned feature flags.
|
|
33
|
+
- **Correctness.** Edge cases, error handling, type / contract violations,
|
|
34
|
+
broken invariants.
|
|
35
|
+
- **Security.** OWASP Top 10, auth, data exposure. (`/security` for depth.)
|
|
36
|
+
- **Performance.** N+1, blocking calls in hot paths, unbounded loops, indexes
|
|
37
|
+
the diff actually touches.
|
|
38
|
+
- **Maintainability.** Complexity, naming, duplication — only when material.
|
|
39
|
+
|
|
40
|
+
## Output Format
|
|
41
|
+
### 🚨 Critical (blocks merge)
|
|
42
|
+
### ⚠️ Warnings (should fix)
|
|
43
|
+
### 💡 Suggestions (nice to have)
|
|
44
|
+
|
|
45
|
+
Each finding: **Location** (`file:line`), **What's wrong**, **Why it matters**,
|
|
46
|
+
**Concrete fix** — not "consider improving".
|
|
47
|
+
|
|
48
|
+
## After the review — verify, then fix
|
|
49
|
+
|
|
50
|
+
Findings are claims, not facts. Validate before acting; validate again after.
|
|
51
|
+
|
|
52
|
+
**Verify each claim.** Re-read the cited `file:line` in context. For
|
|
53
|
+
dead-code or unused-symbol claims, `git grep` the name across the repo before
|
|
54
|
+
trusting it. Mark each **confirmed**, **false positive** (with reason), or
|
|
55
|
+
**uncertain**.
|
|
56
|
+
|
|
57
|
+
**Fix what's confirmed and unambiguous** — minimal shape, one obvious way, no
|
|
58
|
+
change to a public API / response / caller contract. Apply directly. After
|
|
59
|
+
each edit, re-read the changed region and confirm it does what you intended
|
|
60
|
+
without breaking nearby logic. A fix isn't done until you've grounded it the
|
|
61
|
+
same way you grounded the claim.
|
|
62
|
+
|
|
63
|
+
**Stop and ask** when any of these hold (HITL gates — not all the time, only
|
|
64
|
+
here):
|
|
65
|
+
- the finding is **uncertain** after grounding,
|
|
66
|
+
- the fix has **multiple reasonable shapes** (e.g. delete-vs-keep-behind-flag,
|
|
67
|
+
extract-vs-inline, patch-vs-rewrite) — present options with tradeoffs, not a
|
|
68
|
+
chosen path,
|
|
69
|
+
- it **affects downstream** (signatures, response shape, schema, any caller
|
|
70
|
+
contract) or removes a public/exported symbol, or
|
|
71
|
+
- the "dead code" looks intentionally kept (stub for upcoming work, framework
|
|
72
|
+
hook, documented extension point) — confirm before deleting.
|
|
73
|
+
|
|
74
|
+
Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why +
|
|
75
|
+
options) · **false-positive** (why) · **uncertain** (what's needed to decide).
|
|
76
|
+
|
|
77
|
+
End with a one-line verdict: **Ready to merge? Yes / No / With fixes** — and
|
|
78
|
+
the reason in a sentence.
|
|
@@ -81,6 +81,24 @@ function loadConfig() {
|
|
|
81
81
|
return CONFIG;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Parse newline-delimited JSON, skipping (and warning about) malformed lines
|
|
86
|
+
* instead of crashing the whole run on one bad record.
|
|
87
|
+
*/
|
|
88
|
+
function parseJsonl(raw, source) {
|
|
89
|
+
const records = [];
|
|
90
|
+
const lines = raw.split('\n');
|
|
91
|
+
for (let i = 0; i < lines.length; i++) {
|
|
92
|
+
if (!lines[i].trim()) continue;
|
|
93
|
+
try {
|
|
94
|
+
records.push(JSON.parse(lines[i]));
|
|
95
|
+
} catch (e) {
|
|
96
|
+
console.error(`Warning: skipping malformed JSONL line ${i + 1}${source ? ` in ${source}` : ''}: ${e.message}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return records;
|
|
100
|
+
}
|
|
101
|
+
|
|
84
102
|
function parseISODate(s) {
|
|
85
103
|
if (!s) return null;
|
|
86
104
|
try {
|
|
@@ -235,9 +253,7 @@ function extractSignals(sessionFile) {
|
|
|
235
253
|
const metadata = {};
|
|
236
254
|
|
|
237
255
|
const raw = fs.readFileSync(sessionFile, 'utf-8');
|
|
238
|
-
const events = raw
|
|
239
|
-
.filter(line => line.trim())
|
|
240
|
-
.map(line => JSON.parse(line));
|
|
256
|
+
const events = parseJsonl(raw, sessionFile);
|
|
241
257
|
|
|
242
258
|
let turnCount = 0;
|
|
243
259
|
const userMessages = [];
|
|
@@ -1695,7 +1711,7 @@ function extractContextWindow(sessionFile, anchorTs, windowSize) {
|
|
|
1695
1711
|
windowSize = windowSize || 5;
|
|
1696
1712
|
|
|
1697
1713
|
const raw = fs.readFileSync(sessionFile, 'utf-8');
|
|
1698
|
-
const events = raw
|
|
1714
|
+
const events = parseJsonl(raw, sessionFile);
|
|
1699
1715
|
|
|
1700
1716
|
const turns = [];
|
|
1701
1717
|
for (const event of events) {
|
|
@@ -2180,14 +2196,20 @@ function extractMain(sessionsDir) {
|
|
|
2180
2196
|
return 1;
|
|
2181
2197
|
}
|
|
2182
2198
|
|
|
2183
|
-
|
|
2199
|
+
let analyses;
|
|
2200
|
+
try {
|
|
2201
|
+
analyses = JSON.parse(fs.readFileSync(analysisFile, 'utf-8'));
|
|
2202
|
+
} catch (e) {
|
|
2203
|
+
console.log(`Error: ${analysisFile} is not valid JSON (${e.message}). Re-run friction analysis.`);
|
|
2204
|
+
return 1;
|
|
2205
|
+
}
|
|
2184
2206
|
|
|
2185
2207
|
// Load raw signals
|
|
2186
2208
|
const rawFile = '.amp/friction/friction_raw.jsonl';
|
|
2187
2209
|
let signals = [];
|
|
2188
2210
|
if (fs.existsSync(rawFile)) {
|
|
2189
2211
|
const rawContent = fs.readFileSync(rawFile, 'utf-8');
|
|
2190
|
-
signals = rawContent
|
|
2212
|
+
signals = parseJsonl(rawContent, rawFile);
|
|
2191
2213
|
}
|
|
2192
2214
|
|
|
2193
2215
|
// NEW: no per-session BAD verdict. Seed from ALL sessions; the observed-only
|
|
@@ -3,6 +3,7 @@ name: optimize
|
|
|
3
3
|
description: Optimize performance [target]
|
|
4
4
|
usage: /optimize <target-area>
|
|
5
5
|
argument-hint: [file-or-function]
|
|
6
|
+
allowed-tools: Read, Edit, Grep, Glob, Bash(git diff *), Bash(git log *), Bash(git grep *), Bash(rg *)
|
|
6
7
|
---
|
|
7
8
|
Analyze $ARGUMENTS for performance.
|
|
8
9
|
|
|
@@ -14,7 +15,47 @@ Analyze $ARGUMENTS for performance.
|
|
|
14
15
|
- Unnecessary allocations
|
|
15
16
|
|
|
16
17
|
## Output
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
18
|
+
Per bottleneck:
|
|
19
|
+
- **Location** (`file:line`)
|
|
20
|
+
- **Cost** — what's slow and by how much. Concrete ("N+1 over ~1k rows on
|
|
21
|
+
every page load"), not vague ("could be faster").
|
|
22
|
+
- **Optimization** — specific change.
|
|
23
|
+
- **Expected improvement** — order-of-magnitude estimate.
|
|
24
|
+
- **Trade-offs** — readability / memory / consistency cost.
|
|
25
|
+
|
|
26
|
+
## After the analysis — verify, then fix
|
|
27
|
+
|
|
28
|
+
Performance claims are easy to invent. Validate before acting.
|
|
29
|
+
|
|
30
|
+
**Verify each bottleneck.** Re-read the cited `file:line` in context.
|
|
31
|
+
Confirm the path is **actually hot** — look for at least one of:
|
|
32
|
+
- a profile / benchmark / log line showing call frequency or duration,
|
|
33
|
+
- the path sits on an obvious hot loop / per-request handler with real
|
|
34
|
+
volume,
|
|
35
|
+
- the user provided evidence in the request.
|
|
36
|
+
|
|
37
|
+
Without one of those, the claim is **uncertain — don't optimize on
|
|
38
|
+
speculation.** Mark each finding **confirmed**, **false positive** (with
|
|
39
|
+
reason), or **uncertain (needs profiling data)**.
|
|
40
|
+
|
|
41
|
+
**Fix what's confirmed and unambiguous** — minimal change, one obvious
|
|
42
|
+
shape, **no behavior change**, no API change. Apply directly. After
|
|
43
|
+
each edit, re-read the changed region and confirm it still computes the
|
|
44
|
+
same answer (perf optimizations that quietly change semantics are the
|
|
45
|
+
worst kind).
|
|
46
|
+
|
|
47
|
+
**Stop and ask** when (HITL gates — not all the time, only here):
|
|
48
|
+
- the bottleneck is **uncertain** after grounding (no profile / log and
|
|
49
|
+
not obviously hot),
|
|
50
|
+
- the fix has **multiple reasonable shapes** (cache vs precompute vs
|
|
51
|
+
batch vs paginate vs index) — present options with tradeoffs, not a
|
|
52
|
+
chosen path,
|
|
53
|
+
- it changes **public API / response shape / DB schema / caller contract**,
|
|
54
|
+
- it trades **correctness for speed** (lossy approximation, weaker
|
|
55
|
+
consistency, eventual-vs-strict) — even when "obviously" faster, or
|
|
56
|
+
- it touches **concurrency primitives** (locks, atomics, ordering) —
|
|
57
|
+
easy to introduce races.
|
|
58
|
+
|
|
59
|
+
Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why +
|
|
60
|
+
options) · **false-positive** (why) · **uncertain** (what profiling /
|
|
61
|
+
data is needed to decide).
|