Skill Tracer
Skills › gstack › setup-gbrain › transcript-gate.md

transcript-gate.md

105 lines · setup-gbrain/sections/transcript-gate.md at 3f79d81

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1<!-- AUTO-GENERATED from transcript-gate.md.tmpl — do not edit directly -->
2<!-- Regenerate: bun run gen:skill-docs -->
3After memory sync is wired (Step 7) but before persisting the CLAUDE.md
4config (Step 8), ask whether this machine's coding-agent session
5transcripts may go into gbrain. Curated `~/.gstack/` artifacts (learnings,
6timeline, plans, designs, retros) sync whatever the answer; this question
7covers transcripts only. Transcripts are ingested only after the user picks
8`recent`, `all` or `new` (only sessions that start from now on).
9
10Check whether the user already chose. The gate keys on `has`, because `get`
11prints the `off` default for a key that was never set:
12```bash
13_TIM=$(~/.claude/skills/gstack/bin/gstack-config get transcript_ingest_mode 2>/dev/null || true)
14if ~/.claude/skills/gstack/bin/gstack-config has transcript_ingest_mode; then
15 _T='[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]t[0-9][0-9]:[0-9][0-9]:[0-9][0-9]z'
16 case "$(printf '%s' "$_TIM" | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')" in
17 recent|all|off|recent+repos|all+repos|new@$_T|new@$_T+repos)
18 echo "TRANSCRIPT_MODE: $_TIM (repos: $(~/.claude/skills/gstack/bin/gstack-config get transcript_repos 2>/dev/null || true))" ;;
19 *) echo "TRANSCRIPT_MODE: ask (stored value '$_TIM' is not recognized by this version)" ;;
20 esac
21else
22 echo "TRANSCRIPT_MODE: ask (not set)"
23fi
24```
26- `TRANSCRIPT_MODE:` with a value (`recent`, `all`, `off`, `new@<time>`,
27 any of them with `+repos`): the user already chose. Do not ask again;
28 continue to Step 8.
29- `TRANSCRIPT_MODE: ask`: ask once, below. With `SESSION_KIND: spawned` or
30 `headless`, do not ask and do not store a value. Consent is never
31 auto-chosen; leave the key unset (transcripts stay skipped) and report
32 that the next interactive `/sync-gbrain` will ask.
34Size the question with two probes. `--sources transcript` makes the probe
35count transcripts even though none are consented yet:
36```bash
37bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/bin/gstack-memory-ingest.ts --probe --sources transcript
38bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/bin/gstack-memory-ingest.ts --probe --sources transcript --all-history
39```
40Read `Total files in window`, `Total bytes` and the estimate from each.
42**No transcripts found** (both probes report 0): ask yes/no instead:
44> "Ingest coding-agent sessions as they appear?"
46Yes means `recent` (then ask the scope question below); No stores `off`.
48**Otherwise**, AskUserQuestion with the counts. Name both session sources
49and the destination brain from Step 4: the user's Supabase brain (Paths 1,
502a, 2b) or the local PGLite brain on this machine (Path 3).
52> "Found <N_recent> Claude Code and Codex sessions from the last 90 days
53> (<N_all> in all history, <bytes>) across the projects on this machine
54> that your repo policy allows. Ingest them into your <Supabase | local
55> PGLite> brain?
57> What you get: gstack skills load recent context from your past sessions,
58> so the agent finds your prior work without you describing it, and you
59> can ask 'what was I doing on day X'. Per-session pages are searchable,
60> taggable and deletable. Secret scanning runs before any push.
62> What stays the same: nothing leaves this machine unless brain sync is
63> enabled (Step 7). Per-repo trust policies still apply. The first full
64> sync can take a while on a large history (estimate: <est>); skills stay
65> usable while it runs.
67> Multi-machine note: with brain sync enabled, transcript pages sync across
68> your machines. Deleting a page later removes it from gbrain, but git
69> history keeps it in earlier commits. Use `gstack-transcript-prune` to
70> delete in bulk, and `git filter-repo` on the brain remote to remove it
71> from history."
73Options:
74- A) Yes, last 90 days (`recent`)
75- B) Yes, all history (`all`)
76- C) Yes, only new sessions starting now (`new`)
77- E) No, never ingest transcripts (`off`)
79On any yes, ask a second, separate question: "Which repos' sessions?"
80A) every project repo your repo policy allows, or B) only this repo (offer
81B only when `git remote get-url origin` succeeds here). Store nothing until
82both answers are known; if the user cancels in between, store nothing.
83Then store the scope, then the mode value (never the letter; `new` stores
84`new@` plus the current UTC time):
85```bash
86~/.claude/skills/gstack/bin/gstack-config set transcript_repos "$(git remote get-url origin)" # only this repo
87~/.claude/skills/gstack/bin/gstack-config unset transcript_repos # every repo
88~/.claude/skills/gstack/bin/gstack-config set transcript_ingest_mode <recent|all|off|new@$(date -u +%Y-%m-%dT%H:%M:%SZ)>
89bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/lib/transcript-consent.ts --describe
90```
91Tell the user the `--describe` line: what will be ingested, in words.
93For `recent`, `all` or `new@…`, run the first sync now:
94```bash
95bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts --full --no-brain-sync
96```
97(`--no-brain-sync` because Step 7 already wired that path; this runs the
98code import and memory ingest stages, and `all` walks the full history.)
99For `off`, run nothing here; other memory still syncs on the next
102New transcripts are ingested on the next `/sync-gbrain` run. Nothing at
103skill start ingests them.
105Reference doc for users: `setup-gbrain/memory.md#transcripts`.

<!-- AUTO-GENERATED from transcript-gate.md.tmpl — do not edit directly --> <!-- Regenerate: bun run gen:skill-docs --> After memory sync is wired (Step 7) but before persisting the CLAUDE.md config (Step 8), ask whether this machine's coding-agent session transcripts may go into gbrain. Curated ~/.gstack/ artifacts (learnings, timeline, plans, designs, retros) sync whatever the answer; this question covers transcripts only. Transcripts are ingested only after the user picks recent, all or new (only sessions that start from now on).

Check whether the user already chose. The gate keys on has, because get prints the off default for a key that was never set:

_TIM=$(~/.claude/skills/gstack/bin/gstack-config get transcript_ingest_mode 2>/dev/null || true)
if ~/.claude/skills/gstack/bin/gstack-config has transcript_ingest_mode; then
  _T='[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]t[0-9][0-9]:[0-9][0-9]:[0-9][0-9]z'
  case "$(printf '%s' "$_TIM" | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')" in
    recent|all|off|recent+repos|all+repos|new@$_T|new@$_T+repos)
      echo "TRANSCRIPT_MODE: $_TIM (repos: $(~/.claude/skills/gstack/bin/gstack-config get transcript_repos 2>/dev/null || true))" ;;
    *) echo "TRANSCRIPT_MODE: ask (stored value '$_TIM' is not recognized by this version)" ;;
  esac
else
  echo "TRANSCRIPT_MODE: ask (not set)"
fi
  • TRANSCRIPT_MODE: with a value (recent, all, off, new@<time>, any of them with +repos): the user already chose. Do not ask again; continue to Step 8.
  • TRANSCRIPT_MODE: ask: ask once, below. With SESSION_KIND: spawned or headless, do not ask and do not store a value. Consent is never auto-chosen; leave the key unset (transcripts stay skipped) and report that the next interactive /sync-gbrain will ask.

Size the question with two probes. --sources transcript makes the probe count transcripts even though none are consented yet:

bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/bin/gstack-memory-ingest.ts --probe --sources transcript
bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/bin/gstack-memory-ingest.ts --probe --sources transcript --all-history

Read Total files in window, Total bytes and the estimate from each.

No transcripts found (both probes report 0): ask yes/no instead:

"Ingest coding-agent sessions as they appear?"

Yes means recent (then ask the scope question below); No stores off.

Otherwise, AskUserQuestion with the counts. Name both session sources and the destination brain from Step 4: the user's Supabase brain (Paths 1, 2a, 2b) or the local PGLite brain on this machine (Path 3).

"Found <N_recent> Claude Code and Codex sessions from the last 90 days (<N_all> in all history, <bytes>) across the projects on this machine that your repo policy allows. Ingest them into your <Supabase | local PGLite> brain? What you get: gstack skills load recent context from your past sessions, so the agent finds your prior work without you describing it, and you can ask 'what was I doing on day X'. Per-session pages are searchable, taggable and deletable. Secret scanning runs before any push. What stays the same: nothing leaves this machine unless brain sync is enabled (Step 7). Per-repo trust policies still apply. The first full sync can take a while on a large history (estimate: <est>); skills stay usable while it runs. Multi-machine note: with brain sync enabled, transcript pages sync across your machines. Deleting a page later removes it from gbrain, but git history keeps it in earlier commits. Use gstack-transcript-prune to delete in bulk, and git filter-repo on the brain remote to remove it from history."

Options:

  • A) Yes, last 90 days (recent)
  • B) Yes, all history (all)
  • C) Yes, only new sessions starting now (new)
  • E) No, never ingest transcripts (off)

On any yes, ask a second, separate question: "Which repos' sessions?" A) every project repo your repo policy allows, or B) only this repo (offer B only when git remote get-url origin succeeds here). Store nothing until both answers are known; if the user cancels in between, store nothing. Then store the scope, then the mode value (never the letter; new stores new@ plus the current UTC time):

~/.claude/skills/gstack/bin/gstack-config set transcript_repos "$(git remote get-url origin)"  # only this repo
~/.claude/skills/gstack/bin/gstack-config unset transcript_repos                                 # every repo
~/.claude/skills/gstack/bin/gstack-config set transcript_ingest_mode <recent|all|off|new@$(date -u +%Y-%m-%dT%H:%M:%SZ)>
bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/lib/transcript-consent.ts --describe

Tell the user the --describe line: what will be ingested, in words.

For recent, all or new@…, run the first sync now:

bun --no-env-file --config=/dev/null run ~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts --full --no-brain-sync

(--no-brain-sync because Step 7 already wired that path; this runs the code import and memory ingest stages, and all walks the full history.) For off, run nothing here; other memory still syncs on the next /sync-gbrain.

New transcripts are ingested on the next /sync-gbrain run. Nothing at skill start ingests them.

Reference doc for users: setup-gbrain/memory.md#transcripts.

Raw lines 1 to 105
Project instruction file CLAUDE.md :3
Runs code bin/gstack-config :13
Starts an agent spawned :29
Names a skill sync-gbrain :32
Runs code bin/gstack-memory-ingest.ts :37
Involves a person AskUserQuestion :48
Runs code bin/gstack-gbrain-sync.ts :95