This document explains how to give the @claude GitHub Action access to the same knowledge base files that local Claude Code automatically loads.
- Local
/close-issuecommand: Automatically loads ~30k tokens of context including the fullknowledge/directory - @claude GitHub Action: Previously started with zero context, missing all foundational knowledge
Created utils/aggregate-knowledge.sh that:
- Aggregates all files from the
knowledge/directory - Compiles principles, procedures, and personalities into a single context file
- Generates ~1500 lines of foundational knowledge
- Provides the same context as local
--add-dir knowledgeflag
The .github/workflows/claude-implementation.yml file needs to be updated to:
- Switch Action: Change from
anthropics/claude-code-action@betatoanthropics/claude-code-base-action@beta - Add Knowledge Step: Generate knowledge context using the aggregation script
- Inject Context: Pass the aggregated knowledge as a custom prompt
- name: Generate knowledge context
id: knowledge
run: |
echo "Aggregating knowledge base context..."
./utils/aggregate-knowledge.sh > knowledge-context.md
echo "Knowledge context generated ($(wc -l < knowledge-context.md) lines)"
# Create a multiline output for the GitHub Action
echo "KNOWLEDGE_CONTEXT<<EOF" >> $GITHUB_OUTPUT
cat knowledge-context.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- uses: anthropics/claude-code-base-action@beta
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
allowed_tools: "Bash(*),LS,Read,Write,Edit,MultiEdit,Glob,Grep,Task,TodoWrite,WebFetch(domain:*),WebSearch,mcp__git,mcp__github"
prompt: |
You are Claude, an AI assistant designed to help with GitHub issues and pull requests.
# Knowledge Base Context
The following context provides the same foundational knowledge that local Claude Code
receives automatically via the --add-dir knowledge flag. This includes development
principles, procedures, git workflows, and coding conventions used in this repository.
Please read and internalize this context before responding to any requests:
---
${{ steps.knowledge.outputs.KNOWLEDGE_CONTEXT }}
---
# Instructions
Use the above knowledge base context to inform all your responses and implementations.
Pay special attention to:
- **Principles**: tracer-bullets, versioning-mindset, OSE, subtraction-creates-value, etc.
- **Git Workflow**: Always follow established git procedures and branch management
- **Code Conventions**: Follow the established patterns and style guides
- **MCP Tools**: Use MCP tools for git and GitHub operations as specified
- **Procedures**: Follow documented procedures for issue-to-PR workflow
This context ensures you have the same understanding as local Claude Code sessions.Due to GitHub App permissions, the workflow file needs to be updated manually:
- Apply the workflow changes shown above to
.github/workflows/claude-implementation.yml - The changes switch to the base action and inject the full knowledge context
- This gives @claude the same ~30k tokens of context as local Claude Code
After implementation:
- Consistent Knowledge: GitHub Action @claude will have same understanding as local setup
- Better PRs: Claude will understand principles like tracer-bullets, versioning-mindset, OSE
- Proper Workflows: Claude will follow established git procedures and conventions
- Quality Implementation: Same foundational context leads to consistent quality
The knowledge aggregation script can be tested locally:
./utils/aggregate-knowledge.sh | wc -l # Should output ~1500 lines
./utils/aggregate-knowledge.sh | head -20 # Preview the content- The aggregation script processes files in order: ai-index.md, throughput-definition.md, principles/, procedures/, personalities/, tools/
- Output is structured markdown with clear section headers
- Script includes safety checks for missing directories
- Generated context matches the structure of local Claude Code's knowledge loading