Real-World Examples
Practical workflows for learning retrieval and context bundling
Learning Search Workflows
Topic-Specific Searches
# Search authentication patterns disclose learnings --query "authentication" --domains security # Search TypeScript learnings disclose learnings --query "async" --domains typescript --confidence 0.8 # Search for patterns and gotchas disclose learnings --types pattern,gotcha --min-confidence 0.7
Recent High-Confidence Learnings
# Get top 10 highest confidence learnings disclose learnings --limit 10 --sort-by confidence --sort-order desc
Multi-Domain Search
# Search across multiple domains disclose learnings --query "database" \ --domains sql,postgres,mongodb \ --min-confidence 0.75
Session Management
Generate context for AI coding sessions
Session Context Generation
Domain-Specific Context
# Generate context for React development disclose session-context \ --domains react,javascript \ --token-budget 1000 \ --min-confidence 0.8 > session-context.md
High-Quality Context
# Only include high-confidence learnings disclose session-context \ --min-confidence 0.9 \ --token-budget 500 > high-quality-context.md
Pattern-Focused Context
# Focus on design patterns only disclose session-context \ --types pattern \ --domains design,architecture \ --token-budget 800
Context Bundling
Assemble multi-source context for AI tools
Advanced Context Packs
Comprehensive RAG Bundle
# Include all sources with history disclose pack \ --query "API design patterns" \ --scope all \ --include-history \ --history-limit 10 \ --token-budget 3000 > rag-bundle.md
History-Only Bundle
# Bundle only from history (no learnings) disclose pack \ --query "database migration" \ --scope history \ --max-files 8 \ --token-budget 2000
Context for Specific Task
# Context for authentication implementation disclose pack \ --query "JWT token implementation" \ --domains security,authentication \ --scope all \ --token-budget 1500 > auth-context.md
Multi-Domain Search
Search across different knowledge domains
Cross-Domain Examples
Full Stack Search
# Search entire stack disclose learnings \ --query "error handling" \ --domains typescript,bun,http,testing \ --limit 15
Comparing Implementations
# Search different approaches disclose learnings \ --query "async patterns" \ --domains javascript,typescript,golang,rust \ --min-confidence 0.7
Technology Research
# Research specific technologies disclose learnings \ --query "docker compose" \ --domains docker,kubernetes,devops \ --limit 10
CI/CD Integration
Automate learning retrieval in pipelines
Automation Workflows
PR Review Context
#!/bin/bash # Generate context for AI code review CONTEXT=$(disclose pack \ --query "code review guidelines" \ --scope all \ --token-budget 2000) # Use context in review agent agent run --context "$CONTEXT" --task "Review PR"
Pre-Commit Validation
#!/bin/bash
# Check for related learnings before commit
git diff --name-only HEAD^ HEAD | while read file; do
disclose learnings \
--query "$(basename "$file" implementation)" \
--domains "$(git config --get remote.origin.url | grep -o '[^/]*\([^/]*\)' | cut -d/ -f2)" \
--format json
done
Daily Knowledge Sync
name: Sync Knowledge Daily
on:
schedule:
- cron: '0 6 * * *' # Daily at 6 AM
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Check for new learnings
run: |
COUNT=$(disclose learnings --format json | jq '.total')
echo "Total learnings: $COUNT"
Advanced Workflows
Complex patterns and integrations
Performance Optimization
Incremental Context Loading
# Load context in stages for large codebases STAGE_1=$(disclose pack --query "core patterns" --token-budget 500) STAGE_2=$(disclose pack --query "api patterns" --token-budget 500) STAGE_3=$(disclose pack --query "ui patterns" --token-budget 500) # Combine as needed cat <(echo "$STAGE_1") <(echo "$STAGE_2") <(echo "$STAGE_3")
Context Caching Strategy
# Cache common context bundles # Generate once disclose pack --query "authentication" --token-budget 1000 > .cache/auth-context.md # Reuse in sessions cat .cache/auth-context.md # Update cache weekly cron: "0 0 * * 0" disclose pack --query "authentication" > .cache/auth-context.md
Integration with Ecosystem
Complete Learning Workflow
# Capture learning inscribe learning add \ --type pattern \ --summary "Use Bun.serve() for HTTP servers" \ --content "Bun.serve() handles async request handlers differently..." \ --domains bun,http \ --confidence 0.9 # Index automatically via catalog hook # (Learning is automatically indexed by catalog-index hook) # Retrieve later disclose learnings --query "Bun.serve async" --domains bun
Multi-Tool Pipeline
# Gather knowledge from multiple sources inscribe list learnings --limit 100 > recent-learnings.txt reflect analyze usage --limit 50 > usage-stats.json # Combine with other sources disclose pack \ --query "best practices" \ --scope all \ --token-budget 2500 > complete-context.md