feat: surface team-knowledge corpus at session start#62
Merged
Conversation
…open The team-knowledge corpus was effectively write-only: /share-learning posts notes but nothing surfaced them when an agent would use them, so they rarely got read. SessionStart now prints a one-line awareness ping when $KNOWLEDGE_REPO_PATH points at a non-empty local clone (the same env var lint:knowledge/new-note use). Hot-path safe: zero network I/O (no gh api), fail-open (any error → no output, never blocks startup), and silent unless a clone is configured and non-empty. Live retrieval stays on-demand elsewhere; this only makes the agent aware the corpus exists and worth an rg.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
The shared
team-knowledgecorpus was effectively write-only —/share-learningposts notes, but nothing pulled them back out when an agent was about to make a decision they'd inform, so they rarely got consulted. This adds the missing read side: at session start, if you've pointedKNOWLEDGE_REPO_PATHat a local clone (the same env varlint:knowledge/new-notealready use) and it has notes, you get a one-line ping reminding the agent the corpus exists and is worth anrg.Fully opt-in and quiet: no env var set → nothing happens. It does no network calls and never blocks startup (the SessionStart hook is a hot path), so it can't slow your session down.
Summary
src/lib/team-knowledge.ts→teamKnowledgeAwareness(repoPath?): lists.mdnotes in the clone (excludesREADME/INDEX/CONTRIBUTING), returns a short awareness block when non-empty,[]otherwise. Zero network, fail-open, never throws.session-start.tscalls it in the display phase, right after the auto-memory pointer./knowledge-style consult path can usegh apiso no clone is needed to read).Test Plan
bun run typecheck— cleanbun test tests/team-knowledge.test.ts— 5/5 (unset path, missing dir, empty corpus, 1 note singular, 3 notes plural)bun test— 581 pass / 0 failbun run lint— cleanNote: independent of #61 (touches different files); the two can merge in any order.