Skip to content

feat(hook): inject project + global memories at session start#128

Merged
wcatz merged 4 commits intomainfrom
feat/session-start-inject-context
Mar 25, 2026
Merged

feat(hook): inject project + global memories at session start#128
wcatz merged 4 commits intomainfrom
feat/session-start-inject-context

Conversation

@wcatz
Copy link
Copy Markdown
Owner

@wcatz wcatz commented Mar 25, 2026

Closes #127

What

The session-start hook now queries ghost.db directly and writes full project context into Claude's stdin before the first message — no tool calls required.

Before: Hook output a static reminder telling Claude to call ghost_project_context. Claude sometimes ignored it.

After: Hook outputs project memories + learned summary + global memories (_global) directly. Context is always present from message one.

Output format

## Ghost context: ghost

**Summary:** <learned_context>

**Memories:**
- [decision] ...
- [architecture] ...

**Global (applies to all projects):**
- [preference] NEVER add Co-Authored-By...
- [convention] ...

Save new discoveries with ghost_memory_save during work.

Falls back to static reminder if project not found or DB unavailable.

wcatz added 2 commits March 25, 2026 12:08
session-start hook now queries ghost.db directly and outputs full
project context (memories + learned summary) plus global memories
(_global project) into Claude's context on every session start.

Claude no longer needs to call ghost_project_context manually —
context is always present from message one, including cross-project
preferences and conventions.

Closes #127
Old redirects told Claude to call ghost_list_projects +
ghost_project_context manually. Now that the hook injects context
directly, update those files to reflect the new behavior.

mcp init now detects old-style redirects (containing ghost_list_projects)
and rewrites them to the current format.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

Warning

Rate limit exceeded

@wcatz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 63ed2bf7-de57-4180-ab6e-6408e5e57b6a

📥 Commits

Reviewing files that changed from the base of the PR and between 003bd19 and 78dae3a.

📒 Files selected for processing (2)
  • internal/mcpinit/hook.go
  • internal/mcpinit/init.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/session-start-inject-context

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wcatz wcatz merged commit 525d100 into main Mar 25, 2026
5 checks passed
@wcatz wcatz deleted the feat/session-start-inject-context branch March 25, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: auto-seed project context in session-start hook

1 participant