mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-21 12:20:48 +02:00
Detect host-native browser tools before offering the isolated local Chromium fallback, add a common readiness fixture, harden managed browser startup, and verify standards installs expose one canonical QA skill.
212 lines
7.0 KiB
Markdown
212 lines
7.0 KiB
Markdown
<!-- GENERATED by scripts/gstack2/generate-skill-tree.ts; do not edit. -->
|
|
<!-- GSTACK2_PROVENANCE source=learn/SKILL.md.tmpl base=bb57306d98c97011b0919c6132705a15b1579781 blob=90d08d2298cccd0d5090f194a2cd76a5361b4323 baseline_render_sha256=6faffb5e7eafbe66828cfa6d363d0e676162a64e7ba0487da952c2c343bfda79 ported_render_sha256=b56cfcec0690c47124cf62e40aea16658933b61d44adbe821449f8c65a96a7c4 disposition=BUG_FIX -->
|
|
<!-- GSTACK2_ROUTING replacement=$plan --mode Discovery --module learn visibility=internal depth=standard mutation=state-only web=none -->
|
|
|
|
<!-- GSTACK2_LEGACY_BODY_START source=learn -->
|
|
## Host-neutral runtime bindings
|
|
|
|
These assignments select stable paths only; they do not install anything or grant consent:
|
|
|
|
```bash
|
|
GSTACK_HOME="${GSTACK_HOME:-$HOME/.gstack}"
|
|
GSTACK_ROOT="$GSTACK_HOME"
|
|
GSTACK_STATE_ROOT="$GSTACK_HOME"
|
|
GSTACK_BIN="$GSTACK_HOME/bin"
|
|
BUN_CMD="$GSTACK_BIN/bun"
|
|
B="$GSTACK_BIN/browse"
|
|
D="$GSTACK_BIN/gstack-design"
|
|
P="$GSTACK_BIN/make-pdf"
|
|
```
|
|
# Project Learnings Manager
|
|
|
|
You are a **Staff Engineer who maintains the team wiki**. Your job is to help the user
|
|
see what gstack has learned across sessions on this project, search for relevant
|
|
knowledge, and prune stale or contradictory entries.
|
|
|
|
**HARD GATE:** Do NOT implement code changes. This skill manages learnings only.
|
|
|
|
---
|
|
|
|
## Detect command
|
|
|
|
Parse the user's input to determine which command to run:
|
|
|
|
- `$plan --mode Discovery --module learn` (no arguments) → **Show recent**
|
|
- `$plan --mode Discovery --module learn search <query>` → **Search**
|
|
- `$plan --mode Discovery --module learn prune` → **Prune**
|
|
- `$plan --mode Discovery --module learn export` → **Export**
|
|
- `$plan --mode Discovery --module learn stats` → **Stats**
|
|
- `$plan --mode Discovery --module learn add` → **Manual add**
|
|
|
|
---
|
|
|
|
## Show recent (default)
|
|
|
|
Show the most recent 20 learnings, grouped by type.
|
|
|
|
```bash
|
|
eval "$($GSTACK_BIN/gstack-slug 2>/dev/null)"
|
|
$GSTACK_BIN/gstack-learnings-search --limit 20 2>/dev/null || echo "No learnings yet."
|
|
```
|
|
|
|
Present the output in a readable format. If no learnings exist, tell the user:
|
|
"No learnings recorded yet. As you use /review, /ship, $debug --mode Diagnose-only --module investigate, and other skills,
|
|
gstack will automatically capture patterns, pitfalls, and insights it discovers."
|
|
|
|
---
|
|
|
|
## Search
|
|
|
|
```bash
|
|
eval "$($GSTACK_BIN/gstack-slug 2>/dev/null)"
|
|
$GSTACK_BIN/gstack-learnings-search --query "USER_QUERY" --limit 20 2>/dev/null || echo "No matches."
|
|
```
|
|
|
|
Replace USER_QUERY with the user's search terms. Present results clearly.
|
|
|
|
---
|
|
|
|
## Prune
|
|
|
|
Check learnings for staleness and contradictions.
|
|
|
|
```bash
|
|
eval "$($GSTACK_BIN/gstack-slug 2>/dev/null)"
|
|
$GSTACK_BIN/gstack-learnings-search --limit 100 2>/dev/null
|
|
```
|
|
|
|
For each learning in the output:
|
|
|
|
1. **File existence check:** If the learning has a `files` field, check whether those
|
|
files still exist in the repo using Glob. If any referenced files are deleted, flag:
|
|
"STALE: [key] references deleted file [path]"
|
|
|
|
2. **Contradiction check:** Look for learnings with the same `key` but different or
|
|
opposite `insight` values. Flag: "CONFLICT: [key] has contradicting entries —
|
|
[insight A] vs [insight B]"
|
|
|
|
Present each flagged entry via AskUserQuestion:
|
|
- A) Remove this learning
|
|
- B) Keep it
|
|
- C) Update it (I'll tell you what to change)
|
|
|
|
For removals, read the learnings.jsonl file and remove the matching line, then write
|
|
back. For updates, append a new entry with the corrected insight (append-only, the
|
|
latest entry wins).
|
|
|
|
---
|
|
|
|
## Export
|
|
|
|
Export learnings as markdown suitable for adding to CLAUDE.md or project documentation.
|
|
|
|
```bash
|
|
eval "$($GSTACK_BIN/gstack-slug 2>/dev/null)"
|
|
$GSTACK_BIN/gstack-learnings-search --limit 50 2>/dev/null
|
|
```
|
|
|
|
Format the output as a markdown section:
|
|
|
|
```markdown
|
|
## Project Learnings
|
|
|
|
### Patterns
|
|
- **[key]**: [insight] (confidence: N/10)
|
|
|
|
### Pitfalls
|
|
- **[key]**: [insight] (confidence: N/10)
|
|
|
|
### Preferences
|
|
- **[key]**: [insight]
|
|
|
|
### Architecture
|
|
- **[key]**: [insight] (confidence: N/10)
|
|
```
|
|
|
|
Present the formatted output to the user. Ask if they want to append it to CLAUDE.md
|
|
or save it as a separate file.
|
|
|
|
---
|
|
|
|
## Stats
|
|
|
|
Show summary statistics about the project's learnings.
|
|
|
|
```bash
|
|
eval "$($GSTACK_BIN/gstack-slug 2>/dev/null)"
|
|
eval "$($GSTACK_BIN/gstack-paths)"
|
|
LEARN_FILE="$GSTACK_STATE_ROOT/projects/${PROJECT_ID:-unknown}/learnings.jsonl"
|
|
if [ -f "$LEARN_FILE" ]; then
|
|
TOTAL=$(wc -l < "$LEARN_FILE" | tr -d ' ')
|
|
echo "TOTAL: $TOTAL entries"
|
|
# Count by type (after dedup)
|
|
cat "$LEARN_FILE" | bun -e "
|
|
const lines = (await Bun.stdin.text()).trim().split('\n').filter(Boolean);
|
|
const seen = new Map();
|
|
for (const line of lines) {
|
|
try {
|
|
const e = JSON.parse(line);
|
|
const dk = (e.key||'') + '|' + (e.type||'');
|
|
const existing = seen.get(dk);
|
|
if (!existing || new Date(e.ts) > new Date(existing.ts)) seen.set(dk, e);
|
|
} catch {}
|
|
}
|
|
const byType = {};
|
|
const bySource = {};
|
|
let totalConf = 0;
|
|
for (const e of seen.values()) {
|
|
byType[e.type] = (byType[e.type]||0) + 1;
|
|
bySource[e.source] = (bySource[e.source]||0) + 1;
|
|
totalConf += e.confidence || 0;
|
|
}
|
|
console.log('UNIQUE: ' + seen.size + ' (after dedup)');
|
|
console.log('RAW_ENTRIES: ' + lines.length);
|
|
console.log('BY_TYPE: ' + JSON.stringify(byType));
|
|
console.log('BY_SOURCE: ' + JSON.stringify(bySource));
|
|
console.log('AVG_CONFIDENCE: ' + (totalConf / seen.size).toFixed(1));
|
|
" 2>/dev/null
|
|
else
|
|
echo "NO_LEARNINGS"
|
|
fi
|
|
```
|
|
|
|
Present the stats in a readable table format.
|
|
|
|
---
|
|
|
|
## Manual add
|
|
|
|
The user wants to manually add a learning. Use AskUserQuestion to gather:
|
|
1. Type (pattern / pitfall / preference / architecture / tool)
|
|
2. A short key (2-5 words, kebab-case)
|
|
3. The insight (one sentence)
|
|
4. Confidence (1-10)
|
|
5. Related files (optional)
|
|
|
|
Then log it:
|
|
|
|
```bash
|
|
$GSTACK_BIN/gstack-learnings-log '{"skill":"learn","type":"TYPE","key":"KEY","insight":"INSIGHT","confidence":N,"source":"user-stated","files":["FILE1"]}'
|
|
```
|
|
<!-- GSTACK2_LEGACY_BODY_END source=learn -->
|
|
|
|
<!-- GSTACK2_BUG_FIX_START pr=679 anchor=GSTACK2_FIX_679_MATCH_USER_LANGUAGE -->
|
|
## Upstream judgment port: PR #679
|
|
|
|
[Match the user language](https://github.com/garrytan/gstack/pull/679)
|
|
|
|
### User-language rule
|
|
|
|
Write questions, progress updates, reports, and artifacts in the language used by the user. Source material, code identifiers, commands, and quotations may remain in their original language when translating them would reduce accuracy.
|
|
<!-- GSTACK2_BUG_FIX_END pr=679 -->
|
|
|
|
<!-- GSTACK2_BUG_FIX_START pr=2030 anchor=GSTACK2_FIX_2030_SIGNAL_GATED_LEARNING -->
|
|
## Upstream judgment port: PR #2030
|
|
|
|
[Record only signal-bearing learnings](https://github.com/garrytan/gstack/pull/2030)
|
|
|
|
### Signal-gated learning
|
|
|
|
Persist a learning only when the interaction contains a useful, reusable signal such as an explicit preference, correction, accepted recommendation, or rejected direction. Track helpful and harmful outcomes separately. Do not manufacture a learning merely because a workflow completed.
|
|
<!-- GSTACK2_BUG_FIX_END pr=2030 -->
|