~cytrogen/gstack

e377ba295d12090cc4a39be6355deb89d51c81b2 — Garry Tan a month ago e04ad1b
feat: dual greptile-history paths (per-project + global)

- Suppressions read from ~/.gstack/projects/{slug}/greptile-history.md
- Triage outcomes write to both per-project and global files
- greptile-triage.md: remote-slug derivation, dual-write instructions
- review/SKILL.md + ship/SKILL.md: updated save path references
- TODO: add smart default QA tier (P2, S)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 files changed, 23 insertions(+), 10 deletions(-)

M TODO.md
M review/SKILL.md
M review/greptile-triage.md
M ship/SKILL.md
M TODO.md => TODO.md +1 -0
@@ 107,6 107,7 @@
  - [ ] Greptile training feedback loop — export suppression patterns to Greptile team for model improvement (P3, S)
  - [ ] E2E test cost tracking — track cumulative API spend, warn if over threshold (P3, S)
  - [ ] E2E model pinning — pin E2E tests to claude-sonnet-4-6 for cost efficiency, add retry:2 for flaky LLM (P2, XS)
  - [ ] Smart default QA tier — after a few runs, check index.md for user's usual tier pick, skip the question (P2, S)

## Ideas & Notes
  - Browser is the nervous system — every skill should be able to see, interact with, and verify the web

M review/SKILL.md => review/SKILL.md +3 -3
@@ 84,7 84,7 @@ After outputting your own findings, if Greptile comments were classified in Step

**Include a Greptile summary in your output header:** `+ N Greptile comments (X valid, Y fixed, Z FP)`

1. **VALID & ACTIONABLE comments:** These are already included in your CRITICAL findings — they follow the same AskUserQuestion flow (A: Fix it now, B: Acknowledge, C: False positive). If the user chooses C (false positive), post a reply using the appropriate API from the triage doc and save the pattern to `~/.gstack/greptile-history.md` (type: fp).
1. **VALID & ACTIONABLE comments:** These are already included in your CRITICAL findings — they follow the same AskUserQuestion flow (A: Fix it now, B: Acknowledge, C: False positive). If the user chooses C (false positive), post a reply using the appropriate API from the triage doc and save the pattern to both per-project and global greptile-history (see greptile-triage.md for write details).

2. **FALSE POSITIVE comments:** Present each one via AskUserQuestion:
   - Show the Greptile comment: file:line (or [top-level]) + body summary + permalink URL


@@ 94,11 94,11 @@ After outputting your own findings, if Greptile comments were classified in Step
     - B) Fix it anyway (if low-effort and harmless)
     - C) Ignore — don't reply, don't fix

   If the user chooses A, post a reply using the appropriate API from the triage doc and save the pattern to `~/.gstack/greptile-history.md` (type: fp).
   If the user chooses A, post a reply using the appropriate API from the triage doc and save the pattern to both per-project and global greptile-history (see greptile-triage.md for write details).

3. **VALID BUT ALREADY FIXED comments:** Reply acknowledging the catch — no AskUserQuestion needed:
   - Post reply: `"Good catch — already fixed in <commit-sha>."`
   - Save to `~/.gstack/greptile-history.md` (type: already-fixed)
   - Save to both per-project and global greptile-history (see greptile-triage.md for write details)

4. **SUPPRESSED comments:** Skip silently — these are known false positives from previous triage.


M review/greptile-triage.md => review/greptile-triage.md +15 -3
@@ 32,7 32,13 @@ The `position != null` filter on line-level comments automatically skips outdate

## Suppressions Check

Read `~/.gstack/greptile-history.md` if it exists. Each line records a previous triage outcome:
Derive the project-specific history path:
```bash
REMOTE_SLUG=$(browse/bin/remote-slug 2>/dev/null || ~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")
PROJECT_HISTORY="$HOME/.gstack/projects/$REMOTE_SLUG/greptile-history.md"
```

Read `$PROJECT_HISTORY` if it exists (per-project suppressions). Each line records a previous triage outcome:

```
<date> | <repo> | <type:fp|fix|already-fixed> | <file-pattern> | <category>


@@ 89,12 95,18 @@ gh api repos/$REPO/issues/$PR_NUMBER/comments \

## History File Writes

Before writing, ensure the directory exists:
Before writing, ensure both directories exist:
```bash
REMOTE_SLUG=$(browse/bin/remote-slug 2>/dev/null || ~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")
mkdir -p "$HOME/.gstack/projects/$REMOTE_SLUG"
mkdir -p ~/.gstack
```

Append one line per triage outcome to `~/.gstack/greptile-history.md`:
Append one line per triage outcome to **both** files (per-project for suppressions, global for retro):
- `~/.gstack/projects/$REMOTE_SLUG/greptile-history.md` (per-project)
- `~/.gstack/greptile-history.md` (global aggregate)

Format:
```
<YYYY-MM-DD> | <owner/repo> | <type> | <file-pattern> | <category>
```

M ship/SKILL.md => ship/SKILL.md +4 -4
@@ 188,12 188,12 @@ For each classified comment:
- The comment (file:line or [top-level] + body summary + permalink URL)
- Your recommended fix
- Options: A) Fix now (recommended), B) Acknowledge and ship anyway, C) It's a false positive
- If user chooses A: apply the fix, commit the fixed files (`git add <fixed-files> && git commit -m "fix: address Greptile review — <brief description>"`), reply to the comment (`"Fixed in <commit-sha>."`), and save to `~/.gstack/greptile-history.md` (type: fix).
- If user chooses C: reply explaining the false positive, save to history (type: fp).
- If user chooses A: apply the fix, commit the fixed files (`git add <fixed-files> && git commit -m "fix: address Greptile review — <brief description>"`), reply to the comment (`"Fixed in <commit-sha>."`), and save to both per-project and global greptile-history (see greptile-triage.md for write details, type: fix).
- If user chooses C: reply explaining the false positive, save to both per-project and global greptile-history (type: fp).

**VALID BUT ALREADY FIXED:** Reply acknowledging the catch — no AskUserQuestion needed:
- Post reply: `"Good catch — already fixed in <commit-sha>."`
- Save to `~/.gstack/greptile-history.md` (type: already-fixed)
- Save to both per-project and global greptile-history (see greptile-triage.md for write details, type: already-fixed)

**FALSE POSITIVE:** Use AskUserQuestion:
- Show the comment and why you think it's wrong (file:line or [top-level] + body summary + permalink URL)


@@ 201,7 201,7 @@ For each classified comment:
  - A) Reply to Greptile explaining the false positive (recommended if clearly wrong)
  - B) Fix it anyway (if trivial)
  - C) Ignore silently
- If user chooses A: post reply using the appropriate API from the triage doc, save to history (type: fp)
- If user chooses A: post reply using the appropriate API from the triage doc, save to both per-project and global greptile-history (type: fp)

**SUPPRESSED:** Skip silently — these are known false positives from previous triage.