Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/expert-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ jobs:
# Check for common security issues
security_issues=0

# Check for hardcoded secrets
if git diff origin/${{ github.event.pull_request.base.ref }}...HEAD | grep -iE "(api[_-]?key|secret|password|token)" | grep -E "^\+"; then
# Check for hardcoded secrets (exclude AI token optimization references)
if git diff origin/${{ github.event.pull_request.base.ref }}...HEAD | grep -iE "(api[_-]?key\s*=|secret\s*=|password\s*=|\btoken\s*=)" | grep -E "^\+" | grep -v -iE "(token.*usage|token.*reduction|token.*optimization|ai.*token|context.*token)"; then
echo "⚠️ **Potential hardcoded secrets detected**" >> review_results.md
security_issues=$((security_issues + 1))
fi
Expand Down
24 changes: 12 additions & 12 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Claude has access to specialized development agents that MUST be used proactivel

6. **sync-coordinator**:
- USE WHEN: Instruction files need synchronization, ADRs are added/changed
- PROVIDES: Automatic synchronization of instruction files across tools
- NOTE: Usually runs automatically via GitHub Actions, manual invocation rarely needed
- PROVIDES: Manual synchronization of instruction files across tools
- NOTE: Developer-side only - run before committing instruction changes

### When to Use Support Agents

Expand Down Expand Up @@ -401,26 +401,26 @@ uv run pytest tests/test_agent_registry.py -v

## Instruction File Synchronization

### Automatic Synchronization Process
### Developer-Side Synchronization Process

This repository uses **automatic pre-merge synchronization** to maintain consistency across all instruction files. When you update CLAUDE.md, ADRs, or developer agents, a sync coordinator agent automatically updates related files in the same PR.
This repository uses **developer-side synchronization** to maintain consistency across all instruction files. When you update CLAUDE.md, ADRs, or developer agents, you must run the sync coordinator agent to update related files before committing.

### How It Works

1. **Trigger**: When a PR modifies key instruction files:
1. **Developer-side Trigger**: Before committing changes to instruction files:
- `docs/decisions/*.md` (ADRs)
- `CLAUDE.md` (this file)
- `docs/developer-agents/*.md`
- `.github/instructions/copilot-instructions.md`
- `.claude/agents/*.md` or `.github/chatmodes/*.md`

2. **Sync Agent**: Runs automatically and:
- Analyzes changes in the PR
- Updates affected instruction files
- **Optimizes prompts**: Replaces code snippets with file references
- Commits changes to the same PR with `[skip-sync]` flag
- Preserves tool-specific features
2. **Manual Sync Process**: Developer runs sync agent and:
- Uses Task tool with `subagent_type: agent-sync-coordinator`
- Agent analyzes git changes and recommends updates
- Developer applies suggested changes
- Commits all changes together in single commit

3. **Single PR**: All changes (original + synchronized) are reviewed together
3. **No CI/CD dependency**: Entirely developer-side, provider-agnostic

### Synchronization Hierarchy

Expand Down
44 changes: 21 additions & 23 deletions docs/decisions/adr-003-instruction-synchronization.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ Keeping these files synchronized is critical for consistent developer experience

## Decision

We will implement **pre-merge automatic synchronization** using an AI-powered sync coordinator agent that:
We will implement **developer-side synchronization** using an AI-powered sync coordinator agent that:

1. **Triggers during PR review** when instruction files change
2. **Commits updates to the same PR** before merge
1. **Triggers before committing** when developers modify instruction files
2. **Runs via developer's AI assistant** using native agent implementations
3. **Preserves natural language** without templates
4. **Maintains tool-specific features** while ensuring consistency
5. **Optimizes prompts** by replacing code snippets with file references to minimize context window usage
6. **Provider-agnostic** - no dependency on external CI/CD systems

### Synchronization Hierarchy

Expand Down Expand Up @@ -64,13 +65,14 @@ Skip if:
- **Clean git history** - One merge for complete change

### Negative
- **PR complexity** - PRs may have additional commits from sync
- **Potential noise** - Multiple sync runs if PR updated frequently
- **CI complexity** - More complex GitHub Actions workflow
- **Developer discipline required** - Developers must remember to run sync
- **Manual process** - No automatic enforcement (by design for provider-agnostic)
- **Learning curve** - New developers must understand sync workflow

### Neutral
- **Review burden** - Reviewers see sync changes (but this is actually good for transparency)
- **Commit count** - PRs will have 1-2 additional commits
- **Provider independence** - No dependency on specific CI/CD platforms
- **Performance** - Sync runs in <20 seconds using git-driven detection
- **Token efficiency** - Optimized to use <3K tokens per sync check

## Implementation

Expand All @@ -82,21 +84,17 @@ Create `docs/developer-agents/sync-coordinator.md` with:
- **Prompt optimization**: Replace inline code with file references
- **Context reduction**: Remove duplicate information, use cross-references

### Phase 2: GitHub Action Workflow
Create `.github/workflows/sync-instructions.yml`:
```yaml
on:
pull_request:
types: [opened, synchronize]
paths: [relevant instruction files]

jobs:
sync:
if: !contains(github.event.head_commit.message, '[skip-sync]')
steps:
- Run sync coordinator agent
- Commit changes to PR with [skip-sync] flag
```
### Phase 2: Native Agent Implementations
Create agent implementations for each AI tool:
- **Claude**: `.claude/agents/agent-sync-coordinator.md`
- **GitHub Copilot**: `.github/chatmodes/sync-coordinator.chatmode.md`
- **Cursor IDE**: Sync reminder in `.cursor/rules/project-rules.mdc`

Each implementation:
- Uses git diff to identify changes
- Maps source files to target files
- Provides fast, targeted sync recommendations
- No external API dependencies

### Phase 3: Documentation
- Update CLAUDE.md with sync process
Expand Down
Loading