You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+147Lines changed: 147 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,9 @@ AGENTS.md is also symlinked to CLAUDE.md so that Claude reads the index natively
63
63
|`watch`| Watch `.agents/` for changes and auto-regenerate `AGENTS.md`|
64
64
|`import <url>`| Import a rule/skill/workflow from a URL |
65
65
|`hook`| Install a pre-commit git hook for auto-sync |
66
+
|`inherit <label> <path>`| Add an inheritance link to AGENTS.md |
67
+
|`inherit --list`| List current inheritance links |
68
+
|`inherit --remove <label>`| Remove an inheritance link by label |
66
69
|`status`| Show the current sync status of all targets and symlinks |
67
70
|`add <type> <name>`| Add a new rule, skill, or workflow from a template (type is `rule`, `skill`, or `workflow`) |
68
71
|`index`| Regenerate `AGENTS.md` by scanning the contents of `.agents/`|
@@ -79,6 +82,150 @@ AGENTS.md is also symlinked to CLAUDE.md so that Claude reads the index natively
79
82
|`--dry-run`| Show what would be done without making changes |
80
83
|`--force`| Overwrite existing files and symlinks |
81
84
85
+
## Inheritance
86
+
87
+
Projects can inherit agent rules from parent directories (org, team, global) using a convention-based approach. This enables hierarchical rule sharing without duplicating files.
88
+
89
+
### How It Works
90
+
91
+
Add an `## Inherits` section to your project's `AGENTS.md` that links to parent-level agent configs:
92
+
93
+
```markdown
94
+
## Inherits
95
+
-[global](../../AGENTS.md)
96
+
-[team](../AGENTS.md)
97
+
```
98
+
99
+
AI agents (Claude, Codex, etc.) follow markdown links natively — when they read your project's `AGENTS.md`, they'll traverse the inheritance chain and apply rules from all levels.
└── AGENTS.md → ## Inherits links to team, org, global
116
+
```
117
+
118
+
**Inheritance is upward-only.** A project declares what it inherits from. Parent directories don't need to know about their children — when an agent works at the org level, it already has access to org-level rules.
119
+
120
+
### Managing Inheritance
121
+
122
+
```bash
123
+
# Add an inheritance link
124
+
sync-agents inherit global ../../AGENTS.md
125
+
sync-agents inherit team ../AGENTS.md
126
+
127
+
# List current inheritance links
128
+
sync-agents inherit --list
129
+
130
+
# Remove an inheritance link
131
+
sync-agents inherit --remove global
132
+
```
133
+
134
+
The `## Inherits` section is preserved across `sync-agents index` regenerations.
135
+
136
+
### Full Example
137
+
138
+
Set up a three-level hierarchy: global rules → org standards → project config.
When an AI agent reads this file, it follows the `## Inherits` links and applies rules from all three levels — project-specific API conventions, org-wide Go standards, and global security rules.
200
+
201
+
### Verifying Inheritance
202
+
203
+
```bash
204
+
# Check what's inherited
205
+
sync-agents inherit --list
206
+
# Output:
207
+
# - [org](../AGENTS.md)
208
+
# - [global](../../AGENTS.md)
209
+
210
+
# Remove a link if no longer needed
211
+
sync-agents inherit --remove global
212
+
213
+
# Re-add with a different path
214
+
sync-agents inherit global ../../AGENTS.md
215
+
```
216
+
217
+
## Examples
218
+
219
+
The [`examples/`](examples/) directory contains ready-to-use rules, skills, and workflows. Import them directly:
0 commit comments