Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Aug 4, 2025

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

  • βœ… New Script: utils/aggregate-knowledge.sh compiles knowledge/ directory into single context file
  • βœ… Documentation: Complete setup guide with required workflow changes
  • βœ… Context Injection: Ready to provide ~1500 lines of principles, procedures, and personalities
  • ⚠️ Manual Step Required: Workflow update needs manual application due to GitHub App permissions

Git 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.md to complete the implementation.

Fixes #1183


Generated with Claude Code

- 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]>
@amazon-q-developer
Copy link
Contributor

⏳ 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
Copy link
Contributor

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

Copy link
Contributor

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.

Suggested change
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"
Copy link
Contributor

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 "$(&lt; file)" instead of cat file for potentially improved performance.

Severity: Low

Copy link
Contributor

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.

Suggested change
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")"

@amazon-q-developer
Copy link
Contributor

βœ… I finished the code review, and left comments with the issues I found. I will now generate code fix suggestions.

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.

@claude GitHub Action doesn't have access to knowledge base files

1 participant