-
Notifications
You must be signed in to change notification settings - Fork 1
Add knowledge base context injection to @claude GitHub Action #1184
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
base: main
Are you sure you want to change the base?
Conversation
- Create utils/aggregate-knowledge.sh to compile knowledge/ directory context - Add comprehensive documentation for manual workflow setup - Script generates ~1500 lines of foundational knowledge (principles, procedures, personalities) - Provides same context as local Claude Code --add-dir knowledge flag - Documentation includes required workflow changes due to GitHub App permissions Partial fix for #1183: Knowledge aggregation infrastructure ready Manual workflow update required to complete implementation Co-authored-by: Morgan Joyce <[email protected]>
|
β³ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
| echo "" | ||
| fi | ||
| done | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: The script contains repeated code blocks for processing different types of files (principles, procedures, personalities, tools). Consider creating a function to handle the common file processing logic, reducing code duplication.
Severity: Medium
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix addresses the comment by creating a function process_files() to handle the common file processing logic for different types of files (principles, procedures). This function reduces code duplication and improves maintainability. The fix is complete and can be easily extended to handle other file types like personalities and tools by calling the function with appropriate parameters.
| fi | |
| echo "" | |
| fi | |
| # Function to process files in a directory | |
| process_files() { | |
| local dir=$1 | |
| local title=$2 | |
| local file_type=$3 | |
| echo "## $title" | |
| echo "" | |
| if [[ -d "$dir" ]]; then | |
| # Process README first | |
| if [[ -f "$dir/README.md" ]]; then | |
| echo "### ${title} Overview" | |
| echo "" | |
| cat "$dir/README.md" | |
| echo "" | |
| fi | |
| # Process individual files (sorted for consistency) | |
| for file in "$dir"/*.md; do | |
| if [[ -f "$file" && "$(basename "$file")" != "README.md" ]]; then | |
| name=$(basename "$file" .md) | |
| echo "### $file_type: $name" | |
| echo "" | |
| cat "$file" | |
| echo "" | |
| fi | |
| done | |
| fi | |
| } | |
| # Process all principle files | |
| process_files "$KNOWLEDGE_DIR/principles" "Core Principles" "Principle" | |
| # Process all procedure files | |
| process_files "$KNOWLEDGE_DIR/procedures" "Procedures" "Procedure" |
| if [[ -f "$KNOWLEDGE_DIR/ai-index.md" ]]; then | ||
| echo "## AI Index" | ||
| echo "" | ||
| cat "$KNOWLEDGE_DIR/ai-index.md" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: The script uses multiple cat commands to output file contents, which may be inefficient for large files. Consider using echo "$(< file)" instead of cat file for potentially improved performance.
Severity: Low
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix replaces the cat command with echo "$(<file)" for improved performance when outputting file contents. This change addresses the comment by using a more efficient method to read and display file contents, especially beneficial for larger files. The fix is applied to all instances where cat was previously used to output file contents.
| cat "$KNOWLEDGE_DIR/ai-index.md" | |
| echo "" | |
| # Process the main AI index file first | |
| if [[ -f "$KNOWLEDGE_DIR/ai-index.md" ]]; then | |
| echo "## AI Index" | |
| echo "" | |
| echo "$(<"$KNOWLEDGE_DIR/ai-index.md")" | |
| echo "" | |
| fi | |
| # Process throughput definition (the north star) | |
| if [[ -f "$KNOWLEDGE_DIR/throughput-definition.md" ]]; then | |
| echo "## Throughput Definition" | |
| echo "" | |
| echo "$(<"$KNOWLEDGE_DIR/throughput-definition.md")" | |
| echo "" | |
| fi | |
| # Process all principle files | |
| echo "## Core Principles" | |
| echo "" | |
| if [[ -d "$KNOWLEDGE_DIR/principles" ]]; then | |
| # Process README first | |
| if [[ -f "$KNOWLEDGE_DIR/principles/README.md" ]]; then | |
| echo "### Principles Overview" | |
| echo "" | |
| echo "$(<"$KNOWLEDGE_DIR/principles/README.md")" |
|
β I finished the code review, and left comments with the issues I found. I will now generate code fix suggestions. |
Summary
π― Problem: @claude GitHub Action lacks access to knowledge base files that local Claude Code automatically loads (~30k tokens of context)
π§ Solution: Knowledge aggregation infrastructure that provides same foundational context as local setup
Key Changes
utils/aggregate-knowledge.shcompiles knowledge/ directory into single context fileGit Statistics
Files Changed: 2 new files
Lines Added: 253+ lines of implementation
Knowledge Coverage: All principles, procedures, personalities from knowledge/ directory
Impact
Before: @claude starts with zero context, misses established patterns
After: @claude has same foundational understanding as local Claude Code sessions
Manual Action Required
Apply the workflow changes documented in
docs/claude-github-action-knowledge-injection.mdto complete the implementation.Fixes #1183
Generated with Claude Code