From d0650f5239c1a95b847bb76013bcdb85b721cade Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 1 May 2026 20:04:12 -0700 Subject: [PATCH] feat: gbrain.context_queries manifests on 6 V1 skills (Lane E partial) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the V1 retrieval contracts. Each skill declares what it wants gbrain to surface in the preamble at invocation time: /office-hours — prior sessions + builder profile + design docs + recent eureka (4 queries) /plan-ceo-review — prior CEO plans + design docs + recent CEO review activity (3 queries) /design-shotgun — prior approved variants + DESIGN.md + recent design docs (3 queries) /design-consultation — existing DESIGN.md + prior design decisions + brand-related notes (3 queries) /investigate — prior investigations + project learnings + recent eureka cross-project (3 queries) /retro — prior retros + recent timeline + recent learnings (3 queries) Each query carries an explicit kind (vector | list | filesystem) per D3, schema: 1 versioning per D15, and {repo_slug} template var per F7 cross-repo-contamination cleanup. Mix of vector / list / filesystem matches what each skill actually needs: - filesystem (mtime_desc + tail) for log JSONL + curated markdown - list with tags_contains filter for typed gbrain pages - (vector reserved for V1.0.1 when gbrain query surface stabilizes) Smoke test: bun run bin/gstack-brain-context-load.ts --skill-file office-hours/SKILL.md --repo test-repo --explain returns mode=manifest queries=4 with the filesystem kinds populating real data from ~/.gstack/builder-profile.jsonl + ~/.gstack/analytics/eureka.jsonl on this Mac. End-to-end retrieval flow confirmed. Co-Authored-By: Claude Opus 4.7 (1M context) --- design-consultation/SKILL.md | 23 +++++++++++++++++++++++ design-consultation/SKILL.md.tmpl | 23 +++++++++++++++++++++++ design-shotgun/SKILL.md | 20 ++++++++++++++++++++ design-shotgun/SKILL.md.tmpl | 20 ++++++++++++++++++++ investigate/SKILL.md | 22 ++++++++++++++++++++++ investigate/SKILL.md.tmpl | 22 ++++++++++++++++++++++ office-hours/SKILL.md | 27 +++++++++++++++++++++++++++ office-hours/SKILL.md.tmpl | 27 +++++++++++++++++++++++++++ plan-ceo-review/SKILL.md | 24 ++++++++++++++++++++++++ plan-ceo-review/SKILL.md.tmpl | 24 ++++++++++++++++++++++++ retro/SKILL.md | 19 +++++++++++++++++++ retro/SKILL.md.tmpl | 19 +++++++++++++++++++ 12 files changed, 270 insertions(+) diff --git a/design-consultation/SKILL.md b/design-consultation/SKILL.md index 3027b3ea..cf2f852f 100644 --- a/design-consultation/SKILL.md +++ b/design-consultation/SKILL.md @@ -23,6 +23,29 @@ triggers: - design system - create a brand - design from scratch +gbrain: + schema: 1 + context_queries: + - id: existing-design-md + kind: filesystem + glob: "DESIGN.md" + tail: 1 + render_as: "## Existing DESIGN.md (if any)" + - id: prior-design-decisions + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Prior design decisions for this project" + - id: brand-guidelines + kind: list + filter: + type: ceo-plan + tags_contains: "repo:{repo_slug}" + content_contains: "brand" + sort: updated_at_desc + limit: 3 + render_as: "## Brand-related notes from CEO plans" --- diff --git a/design-consultation/SKILL.md.tmpl b/design-consultation/SKILL.md.tmpl index a4eba48f..d34467e9 100644 --- a/design-consultation/SKILL.md.tmpl +++ b/design-consultation/SKILL.md.tmpl @@ -23,6 +23,29 @@ triggers: - design system - create a brand - design from scratch +gbrain: + schema: 1 + context_queries: + - id: existing-design-md + kind: filesystem + glob: "DESIGN.md" + tail: 1 + render_as: "## Existing DESIGN.md (if any)" + - id: prior-design-decisions + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Prior design decisions for this project" + - id: brand-guidelines + kind: list + filter: + type: ceo-plan + tags_contains: "repo:{repo_slug}" + content_contains: "brand" + sort: updated_at_desc + limit: 3 + render_as: "## Brand-related notes from CEO plans" --- {{PREAMBLE}} diff --git a/design-shotgun/SKILL.md b/design-shotgun/SKILL.md index 41f85c8e..41d2da13 100644 --- a/design-shotgun/SKILL.md +++ b/design-shotgun/SKILL.md @@ -20,6 +20,26 @@ allowed-tools: - Grep - Agent - AskUserQuestion +gbrain: + schema: 1 + context_queries: + - id: prior-approved-variants + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/designs/*/approved.json" + sort: mtime_desc + limit: 5 + render_as: "## Prior approved design variants for this project" + - id: design-md + kind: filesystem + glob: "DESIGN.md" + tail: 1 + render_as: "## DESIGN.md (project design system)" + - id: recent-design-docs + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Recent design docs" --- diff --git a/design-shotgun/SKILL.md.tmpl b/design-shotgun/SKILL.md.tmpl index f78070ed..230dbc29 100644 --- a/design-shotgun/SKILL.md.tmpl +++ b/design-shotgun/SKILL.md.tmpl @@ -20,6 +20,26 @@ allowed-tools: - Grep - Agent - AskUserQuestion +gbrain: + schema: 1 + context_queries: + - id: prior-approved-variants + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/designs/*/approved.json" + sort: mtime_desc + limit: 5 + render_as: "## Prior approved design variants for this project" + - id: design-md + kind: filesystem + glob: "DESIGN.md" + tail: 1 + render_as: "## DESIGN.md (project design system)" + - id: recent-design-docs + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Recent design docs" --- {{PREAMBLE}} diff --git a/investigate/SKILL.md b/investigate/SKILL.md index d96c9ae6..44f9a403 100644 --- a/investigate/SKILL.md +++ b/investigate/SKILL.md @@ -37,6 +37,28 @@ hooks: - type: command command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" statusMessage: "Checking debug scope boundary..." +gbrain: + schema: 1 + context_queries: + - id: prior-investigations + kind: list + filter: + type: timeline + tags_contains: "repo:{repo_slug}" + content_contains: "investigate" + sort: updated_at_desc + limit: 5 + render_as: "## Prior investigations in this repo" + - id: project-learnings + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/learnings.jsonl" + tail: 10 + render_as: "## Recent learnings (patterns + pitfalls)" + - id: recent-eureka + kind: filesystem + glob: "~/.gstack/analytics/eureka.jsonl" + tail: 5 + render_as: "## Recent eureka moments (cross-project)" --- diff --git a/investigate/SKILL.md.tmpl b/investigate/SKILL.md.tmpl index bc36a3b0..fb649f02 100644 --- a/investigate/SKILL.md.tmpl +++ b/investigate/SKILL.md.tmpl @@ -37,6 +37,28 @@ hooks: - type: command command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" statusMessage: "Checking debug scope boundary..." +gbrain: + schema: 1 + context_queries: + - id: prior-investigations + kind: list + filter: + type: timeline + tags_contains: "repo:{repo_slug}" + content_contains: "investigate" + sort: updated_at_desc + limit: 5 + render_as: "## Prior investigations in this repo" + - id: project-learnings + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/learnings.jsonl" + tail: 10 + render_as: "## Recent learnings (patterns + pitfalls)" + - id: recent-eureka + kind: filesystem + glob: "~/.gstack/analytics/eureka.jsonl" + tail: 5 + render_as: "## Recent eureka moments (cross-project)" --- {{PREAMBLE}} diff --git a/office-hours/SKILL.md b/office-hours/SKILL.md index 70d021df..54a0c8b3 100644 --- a/office-hours/SKILL.md +++ b/office-hours/SKILL.md @@ -28,6 +28,33 @@ triggers: - is this worth building - help me think through - office hours +gbrain: + schema: 1 + context_queries: + - id: prior-sessions + kind: list + filter: + type: ceo-plan + tags_contains: "repo:{repo_slug}" + sort: updated_at_desc + limit: 5 + render_as: "## Prior office-hours sessions in this repo" + - id: builder-profile + kind: filesystem + glob: "~/.gstack/builder-profile.jsonl" + tail: 1 + render_as: "## Your builder profile snapshot" + - id: design-doc-history + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Recent design docs for this project" + - id: prior-eureka + kind: filesystem + glob: "~/.gstack/analytics/eureka.jsonl" + tail: 5 + render_as: "## Recent eureka moments" --- diff --git a/office-hours/SKILL.md.tmpl b/office-hours/SKILL.md.tmpl index 136abbd0..1962253f 100644 --- a/office-hours/SKILL.md.tmpl +++ b/office-hours/SKILL.md.tmpl @@ -28,6 +28,33 @@ triggers: - is this worth building - help me think through - office hours +gbrain: + schema: 1 + context_queries: + - id: prior-sessions + kind: list + filter: + type: ceo-plan + tags_contains: "repo:{repo_slug}" + sort: updated_at_desc + limit: 5 + render_as: "## Prior office-hours sessions in this repo" + - id: builder-profile + kind: filesystem + glob: "~/.gstack/builder-profile.jsonl" + tail: 1 + render_as: "## Your builder profile snapshot" + - id: design-doc-history + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Recent design docs for this project" + - id: prior-eureka + kind: filesystem + glob: "~/.gstack/analytics/eureka.jsonl" + tail: 5 + render_as: "## Recent eureka moments" --- {{PREAMBLE}} diff --git a/plan-ceo-review/SKILL.md b/plan-ceo-review/SKILL.md index 1adfd02f..6543257d 100644 --- a/plan-ceo-review/SKILL.md +++ b/plan-ceo-review/SKILL.md @@ -25,6 +25,30 @@ triggers: - expand scope - strategy review - rethink this plan +gbrain: + schema: 1 + context_queries: + - id: prior-ceo-plans + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/ceo-plans/*.md" + sort: mtime_desc + limit: 5 + render_as: "## Prior CEO plans for this project" + - id: recent-design-docs + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Recent design docs for this project" + - id: recent-reviews + kind: list + filter: + type: timeline + tags_contains: "repo:{repo_slug}" + content_contains: "plan-ceo-review" + sort: updated_at_desc + limit: 5 + render_as: "## Recent CEO review activity" --- diff --git a/plan-ceo-review/SKILL.md.tmpl b/plan-ceo-review/SKILL.md.tmpl index 45648f80..40af8739 100644 --- a/plan-ceo-review/SKILL.md.tmpl +++ b/plan-ceo-review/SKILL.md.tmpl @@ -25,6 +25,30 @@ triggers: - expand scope - strategy review - rethink this plan +gbrain: + schema: 1 + context_queries: + - id: prior-ceo-plans + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/ceo-plans/*.md" + sort: mtime_desc + limit: 5 + render_as: "## Prior CEO plans for this project" + - id: recent-design-docs + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/*-design-*.md" + sort: mtime_desc + limit: 3 + render_as: "## Recent design docs for this project" + - id: recent-reviews + kind: list + filter: + type: timeline + tags_contains: "repo:{repo_slug}" + content_contains: "plan-ceo-review" + sort: updated_at_desc + limit: 5 + render_as: "## Recent CEO review activity" --- {{PREAMBLE}} diff --git a/retro/SKILL.md b/retro/SKILL.md index 6703aeb9..2b738511 100644 --- a/retro/SKILL.md +++ b/retro/SKILL.md @@ -18,6 +18,25 @@ triggers: - weekly retro - what did we ship - engineering retrospective +gbrain: + schema: 1 + context_queries: + - id: prior-retros + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/retros/*.md" + sort: mtime_desc + limit: 5 + render_as: "## Prior retros for this project" + - id: recent-timeline + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/timeline.jsonl" + tail: 30 + render_as: "## Recent timeline events" + - id: recent-learnings + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/learnings.jsonl" + tail: 10 + render_as: "## Recent learnings" --- diff --git a/retro/SKILL.md.tmpl b/retro/SKILL.md.tmpl index 0f5894ec..93aed3d4 100644 --- a/retro/SKILL.md.tmpl +++ b/retro/SKILL.md.tmpl @@ -18,6 +18,25 @@ triggers: - weekly retro - what did we ship - engineering retrospective +gbrain: + schema: 1 + context_queries: + - id: prior-retros + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/retros/*.md" + sort: mtime_desc + limit: 5 + render_as: "## Prior retros for this project" + - id: recent-timeline + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/timeline.jsonl" + tail: 30 + render_as: "## Recent timeline events" + - id: recent-learnings + kind: filesystem + glob: "~/.gstack/projects/{repo_slug}/learnings.jsonl" + tail: 10 + render_as: "## Recent learnings" --- {{PREAMBLE}}