-
Notifications
You must be signed in to change notification settings - Fork 657
feat: Add Context Management Skill (Knowledge Layer) #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
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
β¦tion - Changed PAI_DIR from a placeholder to a specific user path (/Users/andreas/.claude) - Ensured DA variable is correctly set to "PAI" - Maintained the comment for user guidance on setting PAI_DIR This update enhances user experience by providing a clearer configuration example.
Two-stage ingestion pipeline: - Stage 1: Telegram β Raw notes (#incoming tag) - Stage 2: Raw β Processed notes (project tags, wisdom, etc.) CLI tools: - obs: vault operations (search, read, write, context, incoming, embed, semantic) - ingest: Telegram ingestion (poll, process, status, profiles) Key features: - Project tags as context glue (obs context <project>) - Configurable processing profiles (zettelkasten, simple) - Automatic embedding updates via launchd - Generic docs for upstream contribution Docs: - docs/architecture/context-system.md - docs/architecture/telegram-ingestion.md - docs/architecture/testing-and-migration.md - docs/architecture/CONTRIBUTING.md π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Processing pipeline now handles: - voice/audio β ts (transcription) β fabric patterns β vault - documents β marker (PDF/DOCX extraction) β fabric β vault - URLs β fetch/yt β fabric β vault - photos β tesseract OCR β vault - text β direct to vault Features: - Content-aware routing (only transcribe audio, only OCR images) - Profile-based fabric patterns per content type - Paired output support (Raw + Wisdom notes) - Automatic tag generation based on profile π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add SQLite state tracking for message processing (lib/state.ts) - Tracks pending/processing/completed/failed status - Enables idempotent reprocessing - Adds retry support for failed messages - Add security layer for Telegram ingestion (lib/security.ts) - Prompt injection detection - Command whitelist validation - Rate limiting - Audit logging - Add share-with-hints workflow - Extract #tags, @people, /commands from message text - Apply extracted metadata to note frontmatter - Document iOS Shortcut integration - Add skills infrastructure - SKILL_CONTRACT.md documenting guarantees - self-test.ts health check for skills - context/ and vault/ skill directories - Update ingest.ts with Telegram-valid reactions (ππππ«) - Add test cases for state tracking (TEST-STATE-001 to 006) - Document photo processing options for future Vision AI π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Vision API (GPT-4o) for photo processing with prompt-based analysis - Make embedding model configurable (default: text-embedding-3-large) - Add iOS/macOS integration test cases (Shortcuts, Quick Actions) - Add PAI context integration test cases - Add configuration layering docs for private fork customization - Sanitize PII from all files for public contribution - Add GitHub issue draft for RFC discussion - Update launchd plist with placeholders - Replace hardcoded names with generic examples π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦tifications - Filter messages to only process from PAI Inbox channel (isFromInbox) - Add AI title generation for audio transcripts using gpt-4o-mini - Add PAI Events channel for notifications with JSON payload - JSON payload includes: event_type, status, severity, original_filename, output_files, output_paths for downstream routing (PagerDuty, etc.) - Reply to processed messages with filename - Add LaunchAgent plist and install script for daemon - Lower AI title threshold from 100 to 20 chars π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦ions - Remove replyWithObsidianLink calls from inbox channel - PAI Inbox now stays clean (input only) - PAI Events handles all notifications with JSON payload π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add fixMermaidSyntax() to escape parentheses in mermaid node labels
- Auto-detect mermaid content in Vision API output and apply fix
- Add AI title generation for photos using gpt-4o-mini
- Improve filename sanitization (remove !@#$%^&()[]{}chars)
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
β¦ extraction Phase 1 of ingest pipeline v2 implementation: - Add [key:value] metadata syntax parsing (source, device, user, type, category) - Replace basic fetch with Jina AI Reader for clean markdown URL extraction - Add fallback to basic fetch when Jina fails - YouTube URLs continue to use yt tool (not Jina) - Include source metadata in frontmatter output - Add jinaApiKey and dropboxArchivePath to config - Update self-test with v2 checks (Jina, Dropbox, metadata regex) - Add ADR document: docs/architecture/ingest-pipeline-v2.md - Add test cases TEST-INGv2-001 through TEST-INGv2-120 π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦icons
- Archive pipeline: /archive and /receipt commands with Dropbox sync
- Archive naming: {TYPE} - {YYYYMMDD} - {Description} - {CATEGORY}.{ext}
- Smart name preservation for pre-named files
- Spoken hints extraction from voice memos (Wispr Flow support)
- "hashtag X" β #X, "at name" β @name, "forward slash X" β /X
- Merged hints: caption + spoken hints combined
- Notification severity icons: info/success/warning/error
- Updated skill contract with v2 capabilities
- Added spoken hints test cases (TEST-INGv2-130 to 134)
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
β¦d self-test Context Retrieval: - Add `ingest query` command for searching vault and Dropbox archive - Search by type (CONTRACT, RECEIPT), category (HOME, WORK), year - Full-text search across archive filenames and vault content - Results grouped by document type with source icons AI Intent Parsing: - LLM extracts pipeline, metadata, tags from natural language captions - Uses gpt-4o-mini for fast, low-cost intent extraction - 80% confidence threshold for automatic routing - Falls back to default pipeline when confidence low Self-Test Updates: - Test 19: Events channel (TELEGRAM_OUTBOX_ID) - Test 20: Spoken hints regex patterns - Test 21: Archive naming pattern validation - Test 22: whisper-cpp availability check - Test 23: ffmpeg availability check Updated skill contract and ADR with implementation status. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add executeQuery() for Telegram /query command - Query supports semantic search, person mentions, project tags - Fix obs config to load from both ~/.claude/.env and ~/.config/fabric/.env - Fix embed.ts getOpenAIKey() to check .env files Regression tests pass: self-test (22/22), security, retry, profiles π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add received_date to front matter (original Telegram message timestamp) - Fix critical bug: poll command no longer advances offset (process only) - Add /help command for Telegram bot with syntax documentation - Add source_metadata to Events channel notifications - Fix @FIRST Last mention pattern to normalize to first_last - Change default notification severity from success to info - Document regression tests in test-scripts.md π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add /summarize, /wisdom, /article, /meeting-notes commands - Commands explicitly trigger fabric patterns (not auto based on content) - Clips skip auto-patterns unless explicitly requested - Clarify: use #1on1 as TAG, /meeting-notes as pattern COMMAND - Update /help with pattern commands section - Add iOS Shortcuts integration guide (docs/architecture/ios-shortcuts.md) - Add regression tests for pattern commands (TEST-REG-015 to 020) - Fix RTF document processing with HTML detection and debug logging π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Detect HTML in .txt files (both full documents and styled fragments)
- Convert to markdown with pandoc preserving links
- Clean up style attributes {style="..."} from pandoc output
- Fix bracket issues from nested HTML elements
- Extract actual URLs from tracking wrappers (tldrnewsletter, etc.)
- Strip UTM parameters for cleaner links
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add dictated photo intent section to /help (any caption as Vision prompt) - Add TEST-ING-045b for dictated mermaid intent - Update iOS shortcuts documentation π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦ detection - Add dictated intent detection for archive/receipt pipelines with type/category - Detect document type (INVOICE, RECEIPT, CONTRACT, etc.) from Vision AI content - Sync original files to Dropbox with proper naming convention - Add Dropbox backlink in markdown frontmatter and content - Skip fabric patterns for archive/receipt (straight-through processing) - Add real-time embedding for new notes (fire-and-forget) - Fix embedding model default to text-embedding-3-small (match existing DB) - Update /help command with dictated intent examples - Update SKILL_CONTRACT.md with new features - Add test cases for archive pipeline and real-time embedding π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Help: Add INVOICE, RECEIPT, BILL to auto-detected types - Help: Note Vision AI detects type from content - SKILL_CONTRACT: Add document type detection from content section - SKILL_CONTRACT: Update archive naming examples with INVOICE - test-scripts: Mark TEST-ARC-001-005 and TEST-EMB-001-002 as PASSED - test-scripts: Add TEST-ARC-005 for Vision AI type detection - test-scripts: Update version to 1.1.0 π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Security model: opt-in to work context - New ingest defaults to scope/work (except archive/receipt β scope/private) - Queries default to scope/work only (no tag = excluded) - Support ~private/~work sigils and dictated hints - Add --scope flag to obs search/semantic/context commands - Existing vault stays private until explicitly tagged Sigil syntax: - ~private - personal/private content - ~work - professional content (default for new notes) Dictated detection: - "scope private", "this is personal" β ~private - "scope work", "for work" β ~work Test cases: TEST-SCOPE-001 through TEST-SCOPE-024 π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add ability to specify historic document dates via: - Structured metadata: [date:YYYY-MM-DD] or [date:DD/MM/YYYY] - Dictated intent: "dated June 15th", "from last month", "from yesterday" Document date is now: - Used in archive naming (instead of processing date) - Stored in frontmatter as document_date for ALL content types - Available for voice memos, photos, documents, and all pipelines This allows ingesting historical documents with accurate timestamps reflecting when events actually occurred, not when they were digitized. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
When a document date is provided (via [date:...] or dictated intent), the note filename now uses that date instead of today's date. Example: "dated June 15th" creates "2024-06-15 - Invoice.md" instead of "2024-12-02 - Invoice.md" This applies to ALL content types, ensuring historical documents have filenames reflecting their actual date. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add TEST-DATE-020/021/022 for note filename using document date - Update skill contract to document note filename uses document date - Add scope sigil pattern test (Test 25) to self-test - Add document date pattern test (Test 26) to self-test All 26 self-tests pass. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- 45 unit tests (fixture-based) covering scope, date, archive, regression - Integration test support for isolated test channels - Test channel config (TEST_TELEGRAM_CHANNEL_ID/OUTBOX_ID) - Fixture capture and validation framework - Test assets (PDFs, images, documents) for media tests Unit tests run via `ingest test run` (~3 min) Integration tests require user-sent messages to test channel π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Telegram's getUpdates requires active polling when messages arrive. Changed processViaIngest() to start `ingest watch` in background before messages are sent, then poll for vault file creation. This mirrors production where the watch daemon runs continuously. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- clipboard-capture: Add Mac conditional for caption prompt - file-capture: Change Device Name to Device Model - Both templates now use consistent device identification π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- clipboard-capture: Add caption prompt for all devices before Mac conditional - file-capture: Reorder to set device variable before asking for caption - Both shortcuts now prompt for caption on all platforms π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace pai-contrib with public fork workflow in development plan - Remove Mac conditional from clipboard-capture (single universal caption) - Simplify architecture diagram for standard GitHub fork workflow π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tags.json with DailyFeed, incoming, raw, wisdom, meeting-notes, etc. - Include usage guidelines, auto-detect keywords, and examples - Define project keywords for pai, security, architecture - Add source and topic tag categories π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tags field to NotificationOptions interface - Include tags in event payload when present - Pass tags from processed content to notifications π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create taxonomy.ts to load tags.json and match keywords - Add fuzzy matching for transcription errors (Levenshtein β€2) - Integrate keyword matching before AI tagging in process.ts - Skip AI if keyword coverage is sufficient (β₯3 semantic tags) - Update AI prompt to strongly prefer taxonomy tags - Rename DailyFeed β feed for brevity Tag priority: hints β keywords β AI β status tags π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update CLAUDE.md with full repo architecture and workflows - Create sanitize-for-contrib.sh to check for personal data before fork push - Simplify context-skill-development-plan.md to quick reference format - Document personal vs generic file locations π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Shortcut templates now truncate caption to 1020 chars (Telegram limit) - Fixed sanitize-for-contrib.sh bash array compatibility - Added explicit no-auto-commit rules to CLAUDE.md for fork safety π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove keyword-based auto-tagging (was too aggressive with project tags) - Add /tag command to force AI tagging even with 3+ user tags - AI tagging now runs if: user provides <3 tags OR /tag command used - Make URL fetching opt-in via /article, /wisdom, /summarize, /fetch - URLs saved as-is by default (no auto-fetch) - Update /help with new AI Tagging section and /tag command π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add TELEGRAM_SENDER_BOT_TOKEN for sending to inbox (aligns with iOS shortcuts) - TELEGRAM_BOT_TOKEN now used only for polling/reading - sendToInbox, sendPhotoToInbox, sendDocumentToInbox use sender token - Add getDeviceModel() for dynamic device detection via system_profiler - Normalize metadata to lowercase: [device:mac studio] [user:andreas] - Add Jira skill (Commitment domain) with CLI-first architecture π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦tern - Add /extract-content and /clean pipeline commands for web content extraction - Create extract_page_content fabric pattern for stripping web UI noise - Update Context SKILL.md with URL capture workflow using Fabric + pipeline π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add /extract-content and /clean to allowed commands in security.ts - Fix SKILL.md URL capture workflow to use --pipeline flag π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace shell echo with Bun.spawn stdin for applyFabricPatterns(). Complex markdown with code blocks, backticks, and quotes was breaking shell escaping. Now content is piped directly to fabric via stdin. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦notes - Wisdom notes now inherit user-provided tags from ingestion command - Add hasWisdomSibling flag to ProcessedContent interface - Raw notes link forward to Wisdom: π **Processed:** [[...-Wisdom]] - Wisdom notes link back to Raw: π **Source:** [[...-Raw]] π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Filter system/meta tags from display (incoming, raw, source/telegram) - Show user-meaningful tags first (architecture, philosophy, etc.) - Fix inline tag regex to exclude markdown anchors like #-updates - Increase tag display limit from 2 to 3 tags, 30 to 35 chars π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦chive metadata - obs search Type column now uses frontmatter tags only (not inline content tags) - Add frontmatterTags field to ParsedNote and SearchResult interfaces - Restrict document_type/category/date to archive pipeline only - Prevents false type detection from documentation content π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Adds `obs tag add/remove` command to manage note tags via CLI: - obs tag add 3 architecture (by index from last search) - obs tag add "Note Name" project/pai (by note name) - obs tag remove 5 incoming (remove tag) Supports note selectors: numeric index, note name, or full path. Updates SKILL.md with command reference and examples. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- obs load --tag <tag>: Filter loaded results by tag (AND logic) - obs search --type <type>: Filter search by type (transcript, wisdom, etc.) - Updated SKILL.md with new filter examples π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Complements existing --tag (AND) with --any-tag (OR) for flexible queries: - --tag a --tag b: notes with BOTH tags (intersection) - --any-tag a --any-tag b: notes with ANY tag (union) Added to search, semantic, and load commands. SKILL.md updated with language pattern guide for when to use AND vs OR. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Prevents metadata pollution where values from [source:X][device:Y][user:Z] markers were being suggested as tags by the AI tagger. - Filter metadata values (source, device, user) from AI tag suggestions - Add metadata pollution patterns to obs display filter for existing notes π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Provides concrete example of expected search results table format to ensure Claude includes Tags column and full load options. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Title column: 40 β 50 chars - Tags: Show ALL tags (removed 3-tag limit) - Tags wrap to multiple lines with proper table alignment - Tag line width: 50 chars before wrapping π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add ${PAI_DIR} variable substitution in load-core-context.ts hook
- Remove Context skill routing from CORE (auto-discovered by Claude Code)
- Context skill now discovered natively from ~/.claude/skills/Context/
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add Context skill routing back to CORE with two-phase workflow reminder - Reference extended Context docs (workflows, CLI reference, concepts) - Update Context description with better trigger examples π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace vault path in SKILL.md example with ${OBSIDIAN_VAULT_PATH}
- Add tags.example.json as template, gitignore personal tags.json
- Replace [user:andreas] with [user:testuser] in code comments and tests
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
eab4a77 to
b77c896
Compare
Author
|
Apologies... I had to close this PR. My local git setup got tangled and couldn't figure out a way to rebase the PR with my latest work. I'll create a new one, once I have untangled my setup. |
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.
Summary
Implements the Knowledge Layer from the Life OS vision β a complete pipeline for capturing, processing, and retrieving personal context.
Related Discussions:
What This Adds
Two CLIs (TypeScript/Bun)
ingestpoll,watch,direct,search,loadobssearch,semantic,tags,readSkill Definition
.claude/skills/Context/with:SKILL.md- Skill definition with workflow routingREADME.md- Quick start guideworkflows/- Semantic search and context loading workflowsdocs/- CONCEPTS, CLI-REFERENCE, CAPTURE-TIPS, SHORTCUTSDocumentation
Setup Guides:
Skill Documentation (
.claude/skills/Context/):Workflows:
iOS Shortcuts
Templates in
shortcuts/for clipboard capture and file sharing via Telegram.Key Features
search(discovery) βload(injection)#tags @people /commands ~scope [metadata]~private/~workseparationWhat's NOT Included (Yet)
Test Framework: A comprehensive 4-layer test pyramid exists (unit, integration, CLI, acceptance) but contains personal fixtures. A sanitized version with synthetic fixtures will follow in a separate PR.
Validated via Docker Clean Room
cd bin/ingest/deployment
make cleanroom-build SKILL_REPO=mellanon/Personal_AI_Infrastructure SKILL_BRANCH=release/context-skill
make cleanroom-test # β PASSED## Required Configuration
Required
OBSIDIAN_VAULT_PATH=~/Documents/your_vault
For Telegram ingestion
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHANNEL_ID=-100your_channel_id
Optional (semantic search)
OPENAI_API_KEY=sk-...## Follows PAI Principles
pbpaste | ingest direct --tags "project/pai".claude/skills/Context/