aimgr supports git-based tracking of your AI resource repository. This provides:
- Full audit trail - Every import, sync, and remove operation is recorded
- Change history - View what changed, when, and why
- Recoverability - Easily revert unwanted changes
- Collaboration - Share repository state across teams
# Initialize repository with git tracking
aimgr repo init
# Output:
# ✓ Repository structure initialized at: ~/.local/share/ai-config/repo
# ✓ Git repository initialized
# ✓ .gitignore created
# ✓ Initial commit created
#
# ✨ Repository ready for git-tracked operationsThis command:
- Creates the repository directory structure
- Initializes a git repository
- Creates
.gitignoreto exclude.workspace/cache - Makes an initial commit
# Import resources - automatically creates commit
aimgr repo add local:~/my-resources/
# Output:
# Importing from: ~/my-resources
# ...
# Summary: 3 added, 0 updated, 0 failed, 0 skipped (3 total)
#
# Git commit created: "aimgr: import 3 resource(s) (2 skills, 1 command)"Every successful import creates a descriptive commit.
# Remove resource - automatically creates commit
aimgr repo remove --force skill/old-skill
# Output:
# ✓ Removed skill/old-skill
#
# Git commit created: "aimgr: remove skill: old-skill"cd ~/.local/share/ai-config/repo
git log --oneline
# Example output:
# a1b2c3d aimgr: remove skill: old-skill
# e4f5g6h aimgr: import 3 resource(s) (2 skills, 1 command)
# i7j8k9l aimgr: import 1 resource(s) (1 command)
# m0n1o2p aimgr: initialize repository# Show what changed in last commit
cd ~/.local/share/ai-config/repo
git show
# Show changes for specific commit
git show a1b2c3d
# Show diff between commits
git diff m0n1o2p..e4f5g6h# See history of a specific resource
cd ~/.local/share/ai-config/repo
git log --follow skills/pdf-processing/SKILL.md
# See what changed in that file
git log --follow -p skills/pdf-processing/SKILL.mdcd ~/.local/share/ai-config/repo
# See what the last commit changed
git show --stat
# Revert the last commit
git revert HEAD
# Or reset to previous state (destructive!)
git reset --hard HEAD~1# Find when resource was deleted
cd ~/.local/share/ai-config/repo
git log --oneline --all -- skills/old-skill
# Restore from before deletion
git checkout <commit-before-delete> -- skills/old-skill
git checkout <commit-before-delete> -- .metadata/skills/old-skill-metadata.json
# Commit the restoration
git add skills/old-skill .metadata/skills/old-skill-metadata.json
git commit -m "Restore skill: old-skill"cd ~/.local/share/ai-config/repo
# See commits
git log --oneline
# Reset to specific commit (destructive!)
git reset --hard <commit-hash>- ✅ Commands -
commands/*.md - ✅ Skills -
skills/*/SKILL.mdand all skill files - ✅ Agents -
agents/*.md - ✅ Packages -
packages/*.package.json - ✅ Metadata -
.metadata/directory (source URLs, dates, etc.) - ✅ Config -
.gitignore
- ❌ Workspace cache -
.workspace/(Git clones of remote sources)- Excluded via
.gitignore - Can be regenerated with
aimgr repo sync
- Excluded via
All automated commits follow a consistent format:
aimgr: <operation> <details>
aimgr: import 3 resource(s) (2 skills, 1 command)
aimgr: import 1 resource(s) (1 skill)
aimgr: remove skill: pdf-processing
aimgr: remove command: api/deploy
aimgr: remove agent: code-reviewer
aimgr: sync from gh:your-org/ai-tools (3 resources updated)
# On first machine - initialize and add remote
cd ~/.local/share/ai-config/repo
git remote add origin git@github.com:your-org/ai-config-repo.git
git push -u origin main
# On other machines - clone
git clone git@github.com:your-org/ai-config-repo.git ~/.local/share/ai-config/repo
# Configure aimgr to use this location
echo "repo:
path: ~/.local/share/ai-config/repo" > ~/.config/aimgr/aimgr.yamlcd ~/.local/share/ai-config/repo
git pull origin main
# Reinstall resources if needed
aimgr install '*'cd ~/.local/share/ai-config/repo
git push origin main# Set via environment variable
export AIMGR_REPO_PATH=~/custom-ai-repo
aimgr repo init
# Or via config file
echo "repo:
path: ~/custom-ai-repo" > ~/.config/aimgr/aimgr.yaml
aimgr repo initcd ~/.local/share/ai-config/repo
# Create experimental branch
git checkout -b experimental
# Import experimental resources
aimgr repo add local:~/experimental-resources/
# Switch back to main
git checkout main
# Merge when ready
git merge experimentalcd ~/.local/share/ai-config/repo
# Tag stable states
git tag -a v1.0 -m "Stable resource set v1.0"
# List tags
git tag
# Restore to tagged state
git checkout v1.0If the repository is not git-initialized, operations still work normally:
# This works even without git init
aimgr repo add local:~/resources/
# No git commits created, but resources are addedGit tracking is optional - aimgr works fine without it.
The .workspace/ directory (not tracked) may grow over time:
# View cache size
du -sh ~/.local/share/ai-config/repo/.workspace
# Clean old cached repos
aimgr repo prune
# Or manually remove
rm -rf ~/.local/share/ai-config/repo/.workspaceIf sharing across machines, you may encounter conflicts:
cd ~/.local/share/ai-config/repo
git pull origin main
# If conflicts occur
git status # See conflicted files
# Manually resolve conflicts in files
git add <resolved-files>
git commitIf you need to start fresh:
cd ~/.local/share/ai-config/repo
rm -rf .git
aimgr repo init# Initialize before importing resources
aimgr repo init
aimgr repo add local:~/my-resources/# ~/.config/aimgr/aimgr.yaml
sync:
sources:
- url: gh:myorg/team-resources
- path: ~/personal-resources# Push to remote regularly
cd ~/.local/share/ai-config/repo
git push origin main# Check current state
cd ~/.local/share/ai-config/repo
git status
git log --oneline -10
# Make changes
aimgr repo sync
# Verify
git show# Tag known-good states
cd ~/.local/share/ai-config/repo
git tag -a v2.0 -m "Production-ready resource set"# .github/workflows/test-resources.yml
name: Test AI Resources
on:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install aimgr
run: |
curl -sSL https://raw.githubusercontent.com/dynatrace-oss/ai-config-manager/main/install.sh | sh
- name: Verify resources
run: |
aimgr repo verify# .github/workflows/sync-resources.yml
name: Sync AI Resources
on:
schedule:
- cron: '0 0 * * *' # Daily
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Sync resources
run: |
aimgr repo sync
git add .
git commit -m "aimgr: automated sync $(date)"
git push- Sources - Configuring sync sources
- Workspace Caching - Understanding
.workspace/ - Repository Layout - Internal folder structure
- Pattern Matching - Selecting resources