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
221 changes: 221 additions & 0 deletions .claude/amber-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# Amber Background Agent Configuration
# Defines autonomous action policies for different issue types

version: "1.0"

# Risk-based automation policies
automation_policies:

# LOW RISK: Auto-fix and create PR (no approval needed)
auto_fix:
enabled: true
branch_prefix: "amber/auto-fix"
pr_labels: ["auto-generated", "amber", "chore"]
require_tests_pass: true

categories:
- name: "Code Formatting"
patterns:
- "gofmt violations"
- "black formatting"
- "prettier issues"
- "unused imports (Go, Python)"
commands:
go: ["gofmt -w .", "goimports -w ."]
python: ["black .", "isort ."]
typescript: ["npm run format"]

- name: "Import Sorting"
patterns:
- "isort violations"
- "import order issues"

- name: "Documentation Fixes"
patterns:
- "broken internal links"
- "outdated code examples in comments"
- "missing docstrings for public functions"
max_files_per_pr: 5 # Avoid massive doc PRs

- name: "Dependency Patches"
patterns:
- "patch version updates (x.y.Z)"
- "security patches (dependabot alerts)"
require_ci_pass: true
auto_merge: false # Create PR but don't auto-merge

# MEDIUM RISK: Create detailed proposal (requires approval)
propose_for_approval:
enabled: true
action: "create_github_issue"
labels: ["amber-proposal", "needs-review"]

categories:
- name: "Refactoring"
patterns:
- "files exceeding 400 lines"
- "context.TODO() replacements"
- "repeated code patterns (DRY violations)"
proposal_template: |
## Refactoring Proposal (Amber)

**File:** {file_path}
**Current LOC:** {line_count}
**Issue:** {issue_description}

### Proposed Changes
{proposed_changes}

### Risk Assessment
- **Blast Radius:** {blast_radius}
- **Rollback Plan:** {rollback_plan}
- **Testing Strategy:** {testing_strategy}

### Before/After Structure
```
{structure_diff}
```

**Estimated Effort:** {effort_hours} hours
**Priority:** {priority}

---
*Generated by Amber Background Agent*

- name: "Test Coverage"
patterns:
- "missing contract tests"
- "untested error paths"
- "coverage below 60%"
action: "create_draft_pr"
include_test_skeleton: true

- name: "Security Improvements"
patterns:
- "missing input validation"
- "unhandled error returns"
- "hardcoded credentials (non-critical)"
labels: ["security", "amber-proposal", "needs-security-review"]

# HIGH RISK: Report only (manual decision required)
report_only:
enabled: true
action: "create_detailed_report"
notify_via: "github_issue"
labels: ["amber-alert", "requires-decision"]

categories:
- name: "Breaking Changes"
patterns:
- "API contract modifications"
- "database schema changes"
- "public interface breaking changes"
severity: "critical"

- name: "Security Vulnerabilities"
patterns:
- "authentication bypass potential"
- "SQL injection risk"
- "XSS vulnerabilities"
- "secrets exposure"
severity: "critical"
notify_team: "security"

- name: "Architectural Changes"
patterns:
- "new service introduction"
- "technology stack changes"
- "cross-component dependencies"
severity: "high"
require_rfc: true

# Constitution compliance checks
constitution_checks:
enabled: true
reference_file: "CLAUDE.md"

principles:
- id: "principle_v_modularity"
name: "Component Modularity"
check: "file_size_limit"
threshold: 400 # lines
action: "propose_for_approval"

- id: "principle_iii_context"
name: "Proper Context Usage"
check: "context_todo_usage"
pattern: "context.TODO()"
action: "propose_for_approval"

- id: "principle_iv_testing"
name: "Test Coverage"
check: "test_file_existence"
require_test_for:
- "**/handlers/*.go"
- "**/services/*.go"
action: "propose_for_approval"

- id: "principle_ii_auth"
name: "User-Scoped Auth"
check: "service_account_usage"
forbidden_pattern: "DynamicClient.*List|Get.*// user operation"
action: "report_only" # Security issue

# Monitoring & reporting
monitoring:
schedule:
daily:
- "check_recent_commits" # Last 24 hours
- "run_linting_checks"
- "verify_ci_status"

weekly:
- "full_codebase_health_check"
- "test_coverage_analysis"
- "dependency_audit"

monthly:
- "architecture_review"
- "technical_debt_assessment"
- "security_audit"

report_format: "markdown"
report_location: ".amber/reports/"
github_issues: true

# Integration settings
integrations:
github:
enabled: true
auto_label: true
create_issues: true
create_prs: true

ci_cd:
require_pass_before_merge: true
run_tests_on_auto_fix: true

notifications:
slack_webhook: null # Configure if desired
email: null

# Safety guardrails
safety:
max_auto_prs_per_day: 5
max_files_per_auto_pr: 10
require_review_for_auto_merge: true
never_push_to_main: true
always_create_branch: true

excluded_paths:
- ".git/"
- "vendor/"
- "node_modules/"
- "*.lock"
- "*.sum"

# Learning & improvement
learning:
track_false_positives: true
learn_from_rejected_proposals: true
adjust_thresholds_over_time: true
60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/amber-auto-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 🤖 Amber Auto-Fix Request
description: Request Amber to automatically fix linting, formatting, or trivial issues
title: "[Amber] "
labels: ["amber:auto-fix", "automation"]
body:
- type: markdown
attributes:
value: |
## Amber Auto-Fix Request

Use this template to request **low-risk automated fixes** such as:
- Code formatting (gofmt, black, prettier)
- Unused import removal
- Linting violations
- Documentation formatting

Amber will automatically create a PR to address this issue.

- type: textarea
id: description
attributes:
label: Issue Description
description: Describe what needs to be fixed
placeholder: |
Example: "Frontend code has unused imports and doesn't pass eslint checks"
validations:
required: true

- type: input
id: files
attributes:
label: Files to Fix (optional)
description: Specific files or directories to target
placeholder: "components/frontend/src/**/*.tsx"

- type: dropdown
id: fix-type
attributes:
label: Fix Type
description: What kind of fix is needed?
options:
- Code Formatting
- Linting Violations
- Unused Imports
- Documentation Formatting
- All of the above
validations:
required: true

- type: checkboxes
id: confirmation
attributes:
label: Confirmation
options:
- label: I understand this will create an automated PR
required: true
- label: The changes are low-risk and reversible
required: true
- label: All tests should continue to pass after fixes
required: true
78 changes: 78 additions & 0 deletions .github/ISSUE_TEMPLATE/amber-refactor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: 🔧 Amber Refactoring Request
description: Request Amber to perform code refactoring (medium-risk changes)
title: "[Amber Refactor] "
labels: ["amber:refactor", "refactoring"]
body:
- type: markdown
attributes:
value: |
## Amber Refactoring Request

Use this template for **medium-risk refactoring** such as:
- Breaking large files into modules
- Extracting repeated code patterns
- Improving error handling
- Replacing deprecated patterns

Amber will create a PR with the proposed refactoring.

- type: textarea
id: current-state
attributes:
label: Current State
description: Describe the code that needs refactoring
placeholder: |
File: components/backend/handlers/sessions.go
Issue: 3,495 lines, violates Constitution Principle V (max 400 lines)
validations:
required: true

- type: textarea
id: desired-state
attributes:
label: Desired State
description: What should the code look like after refactoring?
placeholder: |
Break into modules:
- sessions/lifecycle.go (create, delete)
- sessions/status.go (status updates)
- sessions/jobs.go (job management)
- sessions/validation.go (input validation)
validations:
required: true

- type: textarea
id: constraints
attributes:
label: Constraints & Requirements
description: Any constraints Amber should follow
placeholder: |
- Must maintain backward compatibility
- No breaking changes to API
- All existing tests must pass
- Follow patterns in CLAUDE.md
validations:
required: true

- type: dropdown
id: priority
attributes:
label: Priority
options:
- P0 - Critical (Constitution violation)
- P1 - High (Tech debt)
- P2 - Medium (Nice to have)
validations:
required: true

- type: checkboxes
id: confirmation
attributes:
label: Confirmation
options:
- label: I have reviewed CLAUDE.md standards
required: true
- label: Backward compatibility is required
required: true
- label: I will review the generated PR before merging
required: true
Loading
Loading