Skip to content

Add skip_knowledge flag to filter irrelevant sessions from knowledge base#3

Merged
notkurt merged 2 commits intomainfrom
claude/ai-summary-escape-hatch-uXt16
Feb 16, 2026
Merged

Add skip_knowledge flag to filter irrelevant sessions from knowledge base#3
notkurt merged 2 commits intomainfrom
claude/ai-summary-escape-hatch-uXt16

Conversation

@notkurt
Copy link
Owner

@notkurt notkurt commented Feb 16, 2026

Summary

This PR adds a mechanism to flag sessions as not relevant for knowledge ingestion, allowing the AI to explicitly mark test chats, demos, and other non-productive sessions so they don't pollute the project knowledge base.

Key Changes

  • AI-driven relevance assessment: Updated the summarization prompt to include a new "Relevance" section where the AI can write "skip" to flag sessions as not worth preserving
  • Frontmatter tracking: Sessions flagged as skip are marked with a skip_knowledge: true field in their frontmatter for downstream filtering
  • Knowledge base filtering: Modified buildKnowledge() to skip sessions with the skip_knowledge flag and log how many were excluded
  • Session listing: Updated the session list display to show "(skipped)" indicator for filtered sessions
  • Export utility function: Made addFrontmatterField() public in session.ts to support frontmatter updates in the background processor
  • Comprehensive tests: Added test cases covering skip/keep detection, case-insensitivity, and missing Relevance sections

Implementation Details

  • The extractSections() function now parses the Relevance section and returns a skipKnowledge boolean flag
  • When a session is flagged as skip, the background processor immediately updates the session file's frontmatter before attempting any knowledge ingestion
  • All knowledge ingestion logic (decisions, mistakes, auto-detected corrections) is wrapped in a !sections.skipKnowledge guard to prevent processing
  • The knowledge builder provides visibility into filtering by logging the count of skipped sessions

https://claude.ai/code/session_01FwyHciZ86DLhgvEH5Gi5Uu

Add a Relevance section to the AI summarization prompt that lets
the AI flag sessions as "skip" when they contain no useful project
knowledge (test chats, meta-conversations, tooling troubleshooting).

When flagged, the session is still stored and summarized but:
- Decisions, mistakes, and corrections are not ingested into knowledge
- A skip_knowledge frontmatter field marks the session for filtering
- Knowledge base rebuilds skip these sessions
- ghost log shows a (skipped) indicator

https://claude.ai/code/session_01FwyHciZ86DLhgvEH5Gi5Uu
@notkurt notkurt marked this pull request as ready for review February 16, 2026 21:16
@notkurt notkurt merged commit cdfc4fd into main Feb 16, 2026
2 checks passed
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.

2 participants

Comments