@event4u/agent-config 1.29.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent-src/commands/agents/audit.md +101 -197
- package/.agent-src/commands/{copilot-agents → agents}/init.md +18 -10
- package/.agent-src/commands/agents/optimize.md +181 -0
- package/.agent-src/commands/agents.md +19 -12
- package/.agent-src/commands/optimize/agents-dir.md +111 -0
- package/.agent-src/commands/optimize.md +10 -8
- package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +6 -0
- package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +2 -3
- package/.agent-src/contexts/contracts/agents-md-anatomy.md +132 -0
- package/.agent-src/skills/agents-md-thin-root/SKILL.md +8 -1
- package/.agent-src/skills/command-writing/SKILL.md +49 -0
- package/.agent-src/skills/copilot-agents-optimization/SKILL.md +3 -3
- package/.agent-src/skills/error-handling-patterns/SKILL.md +2 -2
- package/.agent-src/skills/{repomix → repomix-packer}/SKILL.md +8 -8
- package/.agent-src/skills/roadmap-writing/SKILL.md +9 -0
- package/.agent-src/skills/rule-writing/SKILL.md +21 -0
- package/.agent-src/skills/skill-writing/SKILL.md +19 -0
- package/.agent-src/skills/testing-anti-patterns/SKILL.md +7 -0
- package/.agent-src/templates/AGENTS.md +9 -10
- package/.claude-plugin/marketplace.json +5 -8
- package/AGENTS.md +1 -2
- package/CHANGELOG.md +86 -0
- package/CONTRIBUTING.md +90 -0
- package/README.md +3 -3
- package/docs/architecture.md +2 -2
- package/docs/catalog.md +11 -13
- package/docs/contracts/command-clusters.md +20 -3
- package/docs/contracts/file-ownership-matrix.json +205 -56
- package/docs/getting-started.md +1 -1
- package/docs/guidelines/code-clarity.md +95 -0
- package/docs/guidelines/php/general.md +8 -0
- package/docs/guidelines/php/php-coding-patterns.md +1 -0
- package/docs/skills-catalog.md +27 -3
- package/llms.txt +26 -2
- package/package.json +1 -1
- package/scripts/chat_history.py +166 -36
- package/scripts/check_command_count_messaging.py +12 -3
- package/scripts/check_portability.py +1 -0
- package/scripts/lint_agents_md.py +33 -0
- package/scripts/release.py +77 -2
- package/scripts/skill_linter.py +10 -3
- package/.agent-src/commands/agents/cleanup.md +0 -194
- package/.agent-src/commands/agents/prepare.md +0 -141
- package/.agent-src/commands/copilot-agents/optimize.md +0 -255
- package/.agent-src/commands/copilot-agents.md +0 -44
- package/.agent-src/commands/optimize/agents.md +0 -144
|
@@ -2,247 +2,151 @@
|
|
|
2
2
|
name: agents:audit
|
|
3
3
|
cluster: agents
|
|
4
4
|
sub: audit
|
|
5
|
-
description:
|
|
6
|
-
skills: [agents-audit, agent-docs-writing,
|
|
5
|
+
description: Audit agent infrastructure — token overhead, rule triggers, AGENTS.md health, Capability-over-Structure adherence, stale references. Read-only, suggest-only, never auto-apply.
|
|
6
|
+
skills: [copilot-agents-optimization, agents-audit, agent-docs-writing, agents-md-thin-root, quality-tools]
|
|
7
7
|
disable-model-invocation: true
|
|
8
8
|
suggestion:
|
|
9
9
|
eligible: true
|
|
10
|
-
trigger_description: "audit
|
|
11
|
-
trigger_context: "
|
|
10
|
+
trigger_description: "audit agent infrastructure, check rule triggers, verify AGENTS.md health, agent-layer health-check"
|
|
11
|
+
trigger_context: "maintainer working on .augment/ files, AGENTS.md, or planning a refactor"
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# /agents audit
|
|
15
|
-
Audits all agent documentation across the project — root `agents/`, module `app/Modules/*/agents/`,
|
|
16
|
-
and `agents/overrides/`.
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
# Root-level docs
|
|
26
|
-
find agents/ -maxdepth 1 -name '*.md' | sort
|
|
27
|
-
|
|
28
|
-
# Subdirectories
|
|
29
|
-
find agents/features/ agents/contexts/ -name '*.md' 2>/dev/null | sort
|
|
30
|
-
|
|
31
|
-
# Overrides
|
|
32
|
-
find agents/overrides/ -name '*.md' -not -name '.gitkeep' 2>/dev/null | sort
|
|
16
|
+
Read-only health check of the **agent layer** — `AGENTS.md` (and tool stubs),
|
|
17
|
+
rules, skills, and pointer/anchor integrity. Measures token overhead, surfaces
|
|
18
|
+
duplicate triggers, verifies the Thin-Root contract, and flags stale references.
|
|
19
|
+
**Suggest only — never auto-apply.** Fixes happen via `/agents optimize` (file
|
|
20
|
+
refactor) or rule-/skill-level commands.
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
**Source of truth:** `.agent-src.uncompressed/` — never read or edit
|
|
23
|
+
`.agent-src/` or `.augment/` directly.
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
find app/Modules/*/agents/ -name '*.md' -not -path '*/roadmaps/*' 2>/dev/null | sort
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
For each file, extract:
|
|
42
|
-
- Filename and path
|
|
43
|
-
- First heading (title)
|
|
44
|
-
- File size and last git modification date (`git log -1 --format='%ai' -- {file}`)
|
|
25
|
+
## Steps
|
|
45
26
|
|
|
46
|
-
###
|
|
27
|
+
### 1. Measure baseline
|
|
47
28
|
|
|
48
|
-
|
|
29
|
+
Count lines affecting token consumption:
|
|
49
30
|
|
|
50
31
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
# Always-loaded (per chat)
|
|
33
|
+
for f in .agent-src.uncompressed/rules/*.md; do
|
|
34
|
+
type=$(head -5 "$f" | grep 'type:' | sed 's/.*"\(.*\)"/\1/')
|
|
35
|
+
[ "$type" = "auto" ] && continue
|
|
36
|
+
lines=$(wc -l < "$f"); echo "always | $lines | $(basename "$f")"
|
|
37
|
+
done | sort -t'|' -k2 -rn
|
|
38
|
+
agents=$(wc -l < AGENTS.md); echo "always | $agents | AGENTS.md"
|
|
39
|
+
|
|
40
|
+
# Auto-loaded rules
|
|
41
|
+
for f in .agent-src.uncompressed/rules/*.md; do
|
|
42
|
+
type=$(head -5 "$f" | grep 'type:' | sed 's/.*"\(.*\)"/\1/')
|
|
43
|
+
[ "$type" != "auto" ] && continue
|
|
44
|
+
lines=$(wc -l < "$f"); echo "auto | $lines | $(basename "$f")"
|
|
45
|
+
done | sort -t'|' -k2 -rn
|
|
46
|
+
|
|
47
|
+
# Skills (top 20 by size)
|
|
48
|
+
for f in .agent-src.uncompressed/skills/*/SKILL.md; do
|
|
49
|
+
name=$(echo "$f" | sed 's|.agent-src.uncompressed/skills/||;s|/SKILL.md||')
|
|
50
|
+
lines=$(wc -l < "$f"); echo "$lines | $name"
|
|
51
|
+
done | sort -rn | head -20
|
|
60
52
|
```
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
| Check | Expected | Severity |
|
|
65
|
-
|---|---|---|
|
|
66
|
-
| Module description file exists | `agents/{name}.md` or `agents/README.md` | 🟡 Warning |
|
|
54
|
+
Report totals (always + auto + skills + AGENTS.md).
|
|
67
55
|
|
|
68
|
-
|
|
69
|
-
| Contexts dir (if complex domain) | `agents/contexts/` | 🔵 Info |
|
|
70
|
-
| Consistent format across modules | Same heading structure, same sections | 🔵 Info |
|
|
56
|
+
### 2. Check rules
|
|
71
57
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
- **Frontmatter**: every rule has `type: "always"` or `type: "auto"` with `description`.
|
|
59
|
+
- **Duplicate triggers**: same `description` → both rules load simultaneously (waste).
|
|
60
|
+
- **Redundancy**: a rule's content duplicated in AGENTS.md or a skill.
|
|
61
|
+
- **Merge candidates**: rules under 15 lines that belong inside a sibling rule.
|
|
75
62
|
|
|
76
63
|
```bash
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# Check if original exists
|
|
82
|
-
if [ -f "$original" ]; then
|
|
83
|
-
echo "✅ $f → $original ($mode)"
|
|
84
|
-
else
|
|
85
|
-
echo "❌ $f → $original (ORPHANED — original missing)"
|
|
86
|
-
fi
|
|
87
|
-
done
|
|
64
|
+
for f in .agent-src.uncompressed/rules/*.md; do
|
|
65
|
+
desc=$(head -5 "$f" | grep 'description:' | sed 's/.*"\(.*\)"/\1/')
|
|
66
|
+
[ -n "$desc" ] && echo "$desc | $(basename "$f")"
|
|
67
|
+
done | sort | awk -F' \\| ' '{descs[$1]=descs[$1] " " $2} END {for (d in descs) {n=split(descs[d], a, " "); if (n>1) print "⚠️ " d " →" descs[d]}}'
|
|
88
68
|
```
|
|
89
69
|
|
|
90
|
-
|
|
91
|
-
|---|---|
|
|
92
|
-
| Override has valid `Mode` header (`extend` or `replace`) | 🔴 Critical if missing |
|
|
93
|
-
| Override has valid `Original` path | 🔴 Critical if missing |
|
|
94
|
-
| Original file exists | 🟡 Warning if orphaned |
|
|
95
|
-
| Override content is not empty (beyond template) | 🟡 Warning if empty |
|
|
96
|
-
|
|
97
|
-
### 4. Classify each document
|
|
98
|
-
|
|
99
|
-
For each doc, determine its category:
|
|
100
|
-
|
|
101
|
-
- **Architecture** — project-level architecture docs (DB, auth, tenancy)
|
|
102
|
-
- **Convention** — coding guidelines and standards
|
|
103
|
-
- **Pattern** — design pattern documentation
|
|
104
|
-
- **Feature plan** — planned features
|
|
105
|
-
- **Context** — codebase area snapshots
|
|
106
|
-
- **Module doc** — module-specific documentation
|
|
107
|
-
- **Override** — project-level override of shared resource
|
|
108
|
-
- **Unclear** — doesn't fit a clear category
|
|
109
|
-
|
|
110
|
-
### 5. Check for issues
|
|
111
|
-
|
|
112
|
-
**Structural issues:**
|
|
113
|
-
- Files in wrong directories (e.g., a guideline in `agents/` root)
|
|
114
|
-
- Missing expected directories
|
|
115
|
-
- Naming inconsistencies (not kebab-case)
|
|
116
|
-
- Module docs that should be root-level (cross-module concern)
|
|
117
|
-
- Root docs that should be module-level (single-module concern)
|
|
118
|
-
|
|
119
|
-
**Content issues (for each doc):**
|
|
120
|
-
- Read the file and extract referenced file paths, class names, method names
|
|
121
|
-
- Use `codebase-retrieval` or file checks to verify references still exist
|
|
122
|
-
- Flag references to deleted/renamed code
|
|
123
|
-
|
|
124
|
-
**Duplication:**
|
|
125
|
-
- Compare doc topics — are two docs covering the same thing?
|
|
126
|
-
- Check overlap between `agents/` docs and `.augment/skills/` content
|
|
127
|
-
- Check overlap between root docs and `.augment/guidelines/` docs
|
|
128
|
-
- Check overlap between module docs and root docs
|
|
129
|
-
|
|
130
|
-
**Coverage gaps:**
|
|
131
|
-
- Active modules without any agent docs
|
|
132
|
-
- Complex areas (many files, many services) without documentation
|
|
133
|
-
- Overrides that reference sections no longer in the original
|
|
134
|
-
|
|
135
|
-
### 6. Display audit report
|
|
70
|
+
### 3. Check `always` → `auto` candidates
|
|
136
71
|
|
|
137
|
-
|
|
138
|
-
═══════════════════════════════════════════════
|
|
139
|
-
🔍 AGENTS AUDIT
|
|
140
|
-
═══════════════════════════════════════════════
|
|
72
|
+
Apply `rule-type-governance`:
|
|
141
73
|
|
|
142
|
-
|
|
74
|
+
1. Applies to EVERY conversation? → keep `always`.
|
|
75
|
+
2. Triggered by a specific topic? → candidate for `auto`.
|
|
76
|
+
3. Core behavior constraint (`scope-control`, `verify-before-complete`, `token-efficiency`, `commit-policy`, `non-destructive-by-default`)? → **NEVER change to auto**.
|
|
143
77
|
|
|
144
|
-
|
|
145
|
-
INVENTAR
|
|
146
|
-
───────────────────────────────────────────────
|
|
78
|
+
Surface candidates with explicit justification. Never auto-apply.
|
|
147
79
|
|
|
148
|
-
|
|
149
|
-
─────────────── ────── ────────────────────────────
|
|
150
|
-
Architecture {n} database-setup.md, ...
|
|
151
|
-
Convention {n} guidelines/controllers.md, ...
|
|
152
|
-
Pattern {n} guidelines/patterns/service-layer.md, ...
|
|
153
|
-
Feature {n} {or "keine"}
|
|
154
|
-
Context {n} {or "keine"}
|
|
155
|
-
Module Doc {n} Import/agents/import.md, ...
|
|
156
|
-
Override {n} overrides/skills/eloquent.md, ...
|
|
157
|
-
Unklar {n} {files that don't fit}
|
|
80
|
+
### 4. Check AGENTS.md — Thin-Root + Capability-over-Structure
|
|
158
81
|
|
|
159
|
-
|
|
160
|
-
MODULE AGENTS
|
|
161
|
-
───────────────────────────────────────────────
|
|
82
|
+
Run the linter and inspect output:
|
|
162
83
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
Grafana ✅ 2 ✅ ❌ ❌
|
|
168
|
-
ClientSoftware ❌ 0 ❌ ❌ ❌
|
|
169
|
-
...
|
|
84
|
+
```bash
|
|
85
|
+
python3 scripts/lint_agents_md.py
|
|
86
|
+
wc -c AGENTS.md
|
|
87
|
+
```
|
|
170
88
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
───────────────────────────────────────────────
|
|
89
|
+
Then audit against the **Capability-over-Structure heuristic** (canonical:
|
|
90
|
+
[`agents-md-anatomy § Iron Law`](../../contexts/contracts/agents-md-anatomy.md#iron-law--capability-over-structure)):
|
|
174
91
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
92
|
+
- Every section answers a *what-the-agent-does* question, not *what-files-exist*.
|
|
93
|
+
- Path bullets without why-clauses ≥ 60 chars → flag for rewrite as capability bullets.
|
|
94
|
+
- Pointer ratio ≥ 0.40; emergency-triage block present and matches the canonical variant.
|
|
178
95
|
|
|
179
|
-
|
|
180
|
-
ISSUES
|
|
181
|
-
───────────────────────────────────────────────
|
|
96
|
+
Failures route to `/agents optimize` — this command does **not** edit.
|
|
182
97
|
|
|
183
|
-
|
|
184
|
-
• {file} — {issue description}
|
|
98
|
+
### 5. Check docs sync + stale references
|
|
185
99
|
|
|
186
|
-
|
|
187
|
-
|
|
100
|
+
```bash
|
|
101
|
+
python3 scripts/check_references.py
|
|
102
|
+
```
|
|
188
103
|
|
|
189
|
-
|
|
190
|
-
|
|
104
|
+
Confirm counts/lists in `.augment/contexts/augment-infrastructure.md` and
|
|
105
|
+
`docs/architecture.md` match the actual `.agent-src.uncompressed/` tree.
|
|
191
106
|
|
|
192
|
-
|
|
107
|
+
### 6. Run skill linter
|
|
193
108
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
109
|
+
```bash
|
|
110
|
+
python3 scripts/skill_linter.py --all --pairs --duplicates 2>&1 | grep "Summary:"
|
|
111
|
+
```
|
|
197
112
|
|
|
198
|
-
|
|
113
|
+
Report FAIL/WARN counts. Don't fix here — delegate to `skill-reviewer` or
|
|
114
|
+
`/optimize skills`.
|
|
199
115
|
|
|
200
|
-
|
|
201
|
-
GAPS
|
|
202
|
-
───────────────────────────────────────────────
|
|
116
|
+
### 7. Present findings
|
|
203
117
|
|
|
204
|
-
|
|
205
|
-
⚠️ Missing contexts: {list}
|
|
206
|
-
⚠️ Orphaned overrides: {list}
|
|
118
|
+
Single table, no auto-edits:
|
|
207
119
|
|
|
208
|
-
|
|
209
|
-
|
|
120
|
+
| # | Category | Finding | Impact | Suggested fix |
|
|
121
|
+
|---|---|---|---|---|
|
|
122
|
+
| 1 | Rule | `{name}` duplicate trigger | Both load simultaneously | Tighten `description` |
|
|
123
|
+
| 2 | Rule | `{name}` is `always` but topic-specific | ~{n} lines saved/chat | Switch to `auto` (with safety gate) |
|
|
124
|
+
| 3 | AGENTS.md | Path enumeration without why-clauses | Capability-over-Structure violation | Run `/agents optimize` |
|
|
125
|
+
| ... | | | | |
|
|
210
126
|
|
|
211
|
-
|
|
127
|
+
Then ask:
|
|
212
128
|
|
|
213
129
|
```
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
2. 📋 Show recommendations only (no file creation)
|
|
218
|
-
3. ❌ No — the audit was all that was needed
|
|
130
|
+
> 1. Walk through suggestions one at a time
|
|
131
|
+
> 2. Apply only high-impact changes (saves > 50 lines or fixes a FAIL)
|
|
132
|
+
> 3. Report only — no edits
|
|
219
133
|
```
|
|
220
134
|
|
|
221
|
-
|
|
135
|
+
## What this command does NOT do
|
|
222
136
|
|
|
223
|
-
- **
|
|
224
|
-
-
|
|
225
|
-
- **
|
|
226
|
-
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
```
|
|
233
|
-
What next?
|
|
234
|
-
|
|
235
|
-
1. 🧹 Start cleanup → /agents-cleanup
|
|
236
|
-
2. 📄 Update a specific doc → /context-refactor
|
|
237
|
-
3. ✅ Done
|
|
238
|
-
```
|
|
137
|
+
- **No edits** — read-only audit. Fixes route to `/agents optimize`,
|
|
138
|
+
`skill-reviewer`, or `/optimize skills`.
|
|
139
|
+
- **No edits to `.agent-src/` or `.augment/`** — those regenerate from
|
|
140
|
+
`.agent-src.uncompressed/`. Edit the source.
|
|
141
|
+
- **No `agents/` folder ops** — scaffolding, folder-audit, folder-cleanup
|
|
142
|
+
live in `/optimize agents-dir`.
|
|
143
|
+
- **No commits, no push, no PR** — finishing the audit is a user decision
|
|
144
|
+
per [`commit-policy`](../../rules/commit-policy.md).
|
|
239
145
|
|
|
240
|
-
##
|
|
146
|
+
## See also
|
|
241
147
|
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
-
|
|
247
|
-
- **Be specific about issues** — name the file, the reference, and what's wrong.
|
|
248
|
-
- **Don't flag missing module docs for tiny/inactive modules** — only for active modules with significant code.
|
|
148
|
+
- [`agents-md-thin-root`](../../skills/agents-md-thin-root/SKILL.md) — caps, pointer-ratio, anatomy.
|
|
149
|
+
- [`agents-md-anatomy`](../../contexts/contracts/agents-md-anatomy.md) — Iron Law, Capability-over-Structure heuristic.
|
|
150
|
+
- [`rule-type-governance`](../../rules/rule-type-governance.md) — `always` vs `auto` decision rules.
|
|
151
|
+
- [`/agents optimize`](optimize.md) — apply Thin-Root contract fixes.
|
|
152
|
+
- [`/optimize agents-dir`](../optimize/agents-dir.md) — `agents/` folder operations (Phase 3).
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
cluster:
|
|
2
|
+
name: agents:init
|
|
3
|
+
cluster: agents
|
|
4
4
|
sub: init
|
|
5
|
-
description:
|
|
6
|
-
skills: [copilot-config, copilot-agents-optimization, agent-docs-writing]
|
|
5
|
+
description: Initialize the agent layer for a consumer project — creates AGENTS.md and .github/copilot-instructions.md from package templates, auto-detects stack, never leaks other projects' identifiers.
|
|
6
|
+
skills: [copilot-config, copilot-agents-optimization, agent-docs-writing, agents-md-thin-root]
|
|
7
7
|
disable-model-invocation: true
|
|
8
8
|
suggestion:
|
|
9
9
|
eligible: false
|
|
10
10
|
rationale: "Project init — only deliberately during onboarding."
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
# /
|
|
13
|
+
# /agents init
|
|
14
|
+
|
|
14
15
|
Interactive initializer that **creates** `AGENTS.md` and
|
|
15
16
|
`.github/copilot-instructions.md` in the consumer project from the
|
|
16
17
|
package-shipped templates (`.augment/templates/AGENTS.md` and
|
|
17
18
|
`.augment/templates/copilot-instructions.md`), filling in placeholders
|
|
18
19
|
based on auto-detected stack + user answers.
|
|
19
20
|
|
|
21
|
+
Tool-agnostic by design — AGENTS.md is the universal entry point
|
|
22
|
+
honoured by Claude Code, Cursor, Codex, Copilot, Augment and Gemini.
|
|
23
|
+
The `.github/copilot-instructions.md` companion is generated alongside
|
|
24
|
+
because GitHub Copilot reads its own file path. Other tool stubs
|
|
25
|
+
(`CLAUDE.md`, `GEMINI.md`, `.cursorrules`) follow the symlink-or-stub
|
|
26
|
+
strategy in [`agents-md-anatomy § Multi-tool symlink strategy`](../../contexts/contracts/agents-md-anatomy.md#multi-tool-symlink-strategy).
|
|
27
|
+
|
|
20
28
|
Use when either file is missing, or the user wants to start over with a
|
|
21
|
-
clean scaffold. For tuning an existing file, use `/
|
|
29
|
+
clean scaffold. For tuning an existing file, use `/agents optimize`.
|
|
22
30
|
|
|
23
31
|
## Steps
|
|
24
32
|
|
|
@@ -35,7 +43,7 @@ Outcomes:
|
|
|
35
43
|
|---|---|
|
|
36
44
|
| Both targets missing | Proceed |
|
|
37
45
|
| One exists, other missing | Ask whether to fill only the missing one |
|
|
38
|
-
| Both exist | Ask confirmation — offer `/
|
|
46
|
+
| Both exist | Ask confirmation — offer `/agents optimize` instead |
|
|
39
47
|
| Template missing | Abort with "package not installed" hint |
|
|
40
48
|
|
|
41
49
|
### 2. Auto-detect stack
|
|
@@ -75,7 +83,7 @@ always with numbered options where applicable:
|
|
|
75
83
|
directory name.
|
|
76
84
|
2. **One-line description** — used in copilot-instructions.md.
|
|
77
85
|
3. **Architecture style** — e.g. "Controllers thin, logic in services,
|
|
78
|
-
validation via FormRequests". Offer `/optimize
|
|
86
|
+
validation via FormRequests". Offer `/agents optimize` style presets
|
|
79
87
|
based on detected framework.
|
|
80
88
|
4. **User-facing strings strategy** — translation files? hardcoded?
|
|
81
89
|
default per framework.
|
|
@@ -132,12 +140,12 @@ Write to `AGENTS.md` and `.github/copilot-instructions.md` (create
|
|
|
132
140
|
Next steps:
|
|
133
141
|
1. Review both files and refine sections that say "document your …"
|
|
134
142
|
2. Commit them as part of the project's initial agent setup
|
|
135
|
-
3. Run `/
|
|
143
|
+
3. Run `/agents optimize` periodically to deduplicate against .augment/
|
|
136
144
|
```
|
|
137
145
|
|
|
138
146
|
### 7. Follow-ups
|
|
139
147
|
|
|
140
|
-
If `agents/` directory does not exist, suggest running `/agents-
|
|
148
|
+
If `agents/` directory does not exist, suggest running `/optimize agents-dir --scaffold`.
|
|
141
149
|
If `.agent-settings.yml` does not exist, suggest running `scripts/install` (then `/onboard` for first-run setup).
|
|
142
150
|
|
|
143
151
|
## Rules
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agents:optimize
|
|
3
|
+
cluster: agents
|
|
4
|
+
sub: optimize
|
|
5
|
+
description: Refactor AGENTS.md to the Thin-Root contract (caps, pointer ratio, capability bullets, emergency-triage) and propagate to tool stubs. Suggest only, never auto-apply.
|
|
6
|
+
skills: [agents-md-thin-root, copilot-agents-optimization, copilot-config, agent-docs-writing]
|
|
7
|
+
disable-model-invocation: true
|
|
8
|
+
suggestion:
|
|
9
|
+
eligible: true
|
|
10
|
+
trigger_description: "refactor AGENTS.md, shrink AGENTS.md, capability bullets, thin-root, optimize agent layer"
|
|
11
|
+
trigger_context: "maintainer working on AGENTS.md (root or consumer template) or its tool stubs"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# /agents optimize
|
|
15
|
+
|
|
16
|
+
Refactor of a single `AGENTS.md` file (project root, package root, or
|
|
17
|
+
consumer template) into the Thin-Root contract: hard char caps, ≥ 40 %
|
|
18
|
+
substantive-pointer ratio, Capabilities-over-Structure Iron Law,
|
|
19
|
+
mandatory emergency-triage block. Propagates the result to the
|
|
20
|
+
multi-tool stubs the consumer ships (`copilot-instructions.md`,
|
|
21
|
+
`CLAUDE.md`, `GEMINI.md`, `.cursorrules`) per the symlink-or-stub
|
|
22
|
+
strategy. **Suggest only — never auto-apply.**
|
|
23
|
+
|
|
24
|
+
**Source of truth:** the canonical contract lives in
|
|
25
|
+
[`agents-md-thin-root`](../../skills/agents-md-thin-root/SKILL.md);
|
|
26
|
+
the long-form anatomy lives in
|
|
27
|
+
[`agents-md-anatomy`](../../contexts/contracts/agents-md-anatomy.md).
|
|
28
|
+
This command orchestrates the diagnose-and-propose flow, it does not
|
|
29
|
+
restate the contract.
|
|
30
|
+
|
|
31
|
+
## When to invoke
|
|
32
|
+
|
|
33
|
+
- Lint emits FAIL or WARN on `AGENTS.md` size, pointer-ratio, or
|
|
34
|
+
path-enumeration.
|
|
35
|
+
- A new section feels like it belongs at the root and you want a
|
|
36
|
+
pre-flight check before adding it.
|
|
37
|
+
- A monorepo grew a 6 KB root `AGENTS.md` because every package
|
|
38
|
+
appended its own section.
|
|
39
|
+
- Migrating from a hand-grown `AGENTS.md` (path enumerations, no
|
|
40
|
+
emergency triage) to the package's contract.
|
|
41
|
+
|
|
42
|
+
## Steps
|
|
43
|
+
|
|
44
|
+
### 1. Identify the target file
|
|
45
|
+
|
|
46
|
+
Default: the AGENTS.md the user is editing right now. If unclear,
|
|
47
|
+
ask:
|
|
48
|
+
|
|
49
|
+
> 1. project root — `AGENTS.md`
|
|
50
|
+
> 2. consumer template — `.agent-src.uncompressed/templates/AGENTS.md`
|
|
51
|
+
> 3. package root — `AGENTS.md` of `event4u/agent-config` itself
|
|
52
|
+
> 4. monorepo package — `<path>/AGENTS.md` (specify path)
|
|
53
|
+
|
|
54
|
+
### 2. Measure baseline
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
target="<path-to-AGENTS.md>"
|
|
58
|
+
wc -c "$target"
|
|
59
|
+
python3 scripts/lint_agents_md.py 2>&1 | grep -A1 "$target" || \
|
|
60
|
+
python3 scripts/lint_agents_md.py
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Record: total chars, gap to FAIL/WARN cap, pointer-ratio output,
|
|
64
|
+
path-enumeration warning count.
|
|
65
|
+
|
|
66
|
+
### 3. Section inventory
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
awk '/^## / {if (h) print h, n; h=$0; n=0; next} {n+=length($0)+1} END {if (h) print h, n}' "$target"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For each section: classify as `keep-inline` (Iron-Law-adjacent,
|
|
73
|
+
≤ 200 chars, no good outboard target) or `outboard-candidate`
|
|
74
|
+
(longer-form prose, table-only sections, narrative). Reference the
|
|
75
|
+
anatomy refactor recipe.
|
|
76
|
+
|
|
77
|
+
### 4. Path-enumeration sweep
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
grep -nE "^[[:space:]]*[-*+][[:space:]]+\`[^\`]*/[^\`]*\`" "$target" | \
|
|
81
|
+
grep -v "\[.*\](.*)" || echo "(none)"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Three or more bare path bullets without why-clauses → propose a
|
|
85
|
+
capability-style rewrite using the anatomy table.
|
|
86
|
+
|
|
87
|
+
### 5. Pointer audit
|
|
88
|
+
|
|
89
|
+
For every link in the file, verify:
|
|
90
|
+
|
|
91
|
+
- *Why*-clause ≥ 60 chars on the same line.
|
|
92
|
+
- Target file resolves on disk (the lint already checks this; flag
|
|
93
|
+
failures here only for human readability).
|
|
94
|
+
- Anchor used when the linked file is large.
|
|
95
|
+
|
|
96
|
+
### 6. Emergency-triage diff
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
diff <(awk '/^## Emergency triage/,/^## [^E]/' "$target") \
|
|
100
|
+
.agent-src.uncompressed/contexts/contracts/emergency-triage-block.md
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Drift = revert in-file block to the canonical variant (package-root
|
|
104
|
+
or consumer-template).
|
|
105
|
+
|
|
106
|
+
### 7. Propose findings — numbered options
|
|
107
|
+
|
|
108
|
+
Present the user with a single numbered-options block:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
> 1. apply suggested edits (I show the diff first, you approve)
|
|
112
|
+
> 2. apply only the highest-impact edit (the one that frees the
|
|
113
|
+
> most chars or fixes a FAIL)
|
|
114
|
+
> 3. report only — no edits
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Never auto-apply. Edits land only after explicit user approval per
|
|
118
|
+
[`scope-control`](../../rules/scope-control.md) and
|
|
119
|
+
[`commit-policy`](../../rules/commit-policy.md).
|
|
120
|
+
|
|
121
|
+
### 8. Multi-tool propagation
|
|
122
|
+
|
|
123
|
+
After AGENTS.md is updated, check for the four common tool stubs and
|
|
124
|
+
keep them in sync:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
ls .github/copilot-instructions.md CLAUDE.md GEMINI.md .cursorrules 2>/dev/null
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For each present file, decide per
|
|
131
|
+
[`agents-md-anatomy § Multi-tool symlink strategy`](../../contexts/contracts/agents-md-anatomy.md#multi-tool-symlink-strategy):
|
|
132
|
+
|
|
133
|
+
- **Symlink target** (`CLAUDE.md`, `GEMINI.md`, `.cursorrules` → `AGENTS.md`)
|
|
134
|
+
→ no edit needed; the link already resolves to the new content.
|
|
135
|
+
- **Stub** (one-line "see AGENTS.md" pointer) → no edit needed.
|
|
136
|
+
- **Independent file** (`.github/copilot-instructions.md` is the
|
|
137
|
+
canonical one — Copilot reads its own path) → present a side-by-side
|
|
138
|
+
diff against AGENTS.md and let the user choose what to copy across.
|
|
139
|
+
Never auto-overwrite.
|
|
140
|
+
|
|
141
|
+
If a tool stub has drifted into a long independent file, surface that
|
|
142
|
+
as a finding in the step-7 numbered options instead of editing here.
|
|
143
|
+
|
|
144
|
+
### 9. Verify before claiming done
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
python3 scripts/lint_agents_md.py
|
|
148
|
+
python3 scripts/check_references.py
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Both green = the refactor is finished. Surface fresh output in the
|
|
152
|
+
final reply per
|
|
153
|
+
[`verify-before-complete`](../../rules/verify-before-complete.md).
|
|
154
|
+
|
|
155
|
+
## Preservation gate — MANDATORY before any edit
|
|
156
|
+
|
|
157
|
+
- [ ] Emergency-triage block keeps all five canonical questions.
|
|
158
|
+
- [ ] No substantive pointer dropped without an outboard target.
|
|
159
|
+
- [ ] No new top-level directory invented for outboarded prose.
|
|
160
|
+
- [ ] Pointer ratio stays ≥ 0.40 after the edit.
|
|
161
|
+
- [ ] Char-count under FAIL cap; under WARN preferred.
|
|
162
|
+
|
|
163
|
+
## What this command does NOT do
|
|
164
|
+
|
|
165
|
+
- **No edits to** `.augment/` **or** `.agent-src/` — those regenerate
|
|
166
|
+
from `.agent-src.uncompressed/`. Edit the source.
|
|
167
|
+
- **No commits, no push, no PR** — finishing the refactor is a user
|
|
168
|
+
decision; cite [`commit-policy`](../../rules/commit-policy.md).
|
|
169
|
+
- **No broader agent-infra audit** — for token overhead, rule
|
|
170
|
+
triggers, and skill-level findings, route to `/agents audit`.
|
|
171
|
+
- **No `agents/` folder ops** — scaffolding, folder-audit, and folder
|
|
172
|
+
cleanup live in `/optimize agents-dir`.
|
|
173
|
+
|
|
174
|
+
## See also
|
|
175
|
+
|
|
176
|
+
- [`agents-md-thin-root`](../../skills/agents-md-thin-root/SKILL.md)
|
|
177
|
+
— caps, pointer-ratio, anatomy, gotchas.
|
|
178
|
+
- [`agents-md-anatomy`](../../contexts/contracts/agents-md-anatomy.md)
|
|
179
|
+
— Iron Law, refactor recipe, monorepo and symlink strategy.
|
|
180
|
+
- [`emergency-triage-block`](../../contexts/contracts/emergency-triage-block.md)
|
|
181
|
+
— canonical block both AGENTS.md variants embed.
|