Add project-aware context to SessionStart hook #16

Merged
forgejo_admin merged 3 commits from 13-session-start-project-aware into main 2026-02-24 19:44:12 +00:00
Contributor

Summary

  • SessionStart now detects which project the cwd belongs to by matching git remote URL against known projects in pal-e-docs
  • Injects project name, active plan, relevant SOPs, and open issues when a project match is found
  • Extracts PAL_E_DOCS_URL into a configurable variable (with default)
  • Adds template query reference (list_notes(tags="template")) to all sessions
  • Falls back to generic SOP list if no project match
  • Fail-open design preserved: all project detection errors silently caught with || true

Test Plan

  • SessionStart in a known project dir (e.g., pal-e-services) shows project context
  • SessionStart in a non-project dir shows generic SOPs only
  • SessionStart with pal-e-docs unreachable still outputs generic context
  • Errors in project detection do not break the hook

Closes #13

## Summary - SessionStart now detects which project the cwd belongs to by matching git remote URL against known projects in pal-e-docs - Injects project name, active plan, relevant SOPs, and open issues when a project match is found - Extracts `PAL_E_DOCS_URL` into a configurable variable (with default) - Adds template query reference (`list_notes(tags="template")`) to all sessions - Falls back to generic SOP list if no project match - Fail-open design preserved: all project detection errors silently caught with `|| true` ## Test Plan - [ ] SessionStart in a known project dir (e.g., pal-e-services) shows project context - [ ] SessionStart in a non-project dir shows generic SOPs only - [ ] SessionStart with pal-e-docs unreachable still outputs generic context - [ ] Errors in project detection do not break the hook Closes #13
SessionStart now detects which project the cwd belongs to by matching
git remote URL against known projects in pal-e-docs. When matched,
injects project name, active plan, relevant SOPs, and open issues.

Also extracts PAL_E_DOCS_URL into a configurable variable and adds
template query reference to all sessions.

Falls back to generic SOP list if no project match. Fail-open design
preserved throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cleanup from self-review: the local active_plan variable was declared
but never assigned or read. The .active_plan jq key reference is
unrelated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix project page slug to use `project-{slug}` convention (was `{slug}-project-page`)
- Replace dead metadata extraction (`.content`, `.body`, `.metadata`, `.meta` don't exist
  in the API) with `.html_content` field, strip HTML tags, limit to 40 lines
- Fix fallback query to extract slug from list response and do a second full fetch
  instead of using the summary response directly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.