@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.
Files changed (46) hide show
  1. package/.agent-src/commands/agents/audit.md +101 -197
  2. package/.agent-src/commands/{copilot-agents → agents}/init.md +18 -10
  3. package/.agent-src/commands/agents/optimize.md +181 -0
  4. package/.agent-src/commands/agents.md +19 -12
  5. package/.agent-src/commands/optimize/agents-dir.md +111 -0
  6. package/.agent-src/commands/optimize.md +10 -8
  7. package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +6 -0
  8. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +2 -3
  9. package/.agent-src/contexts/contracts/agents-md-anatomy.md +132 -0
  10. package/.agent-src/skills/agents-md-thin-root/SKILL.md +8 -1
  11. package/.agent-src/skills/command-writing/SKILL.md +49 -0
  12. package/.agent-src/skills/copilot-agents-optimization/SKILL.md +3 -3
  13. package/.agent-src/skills/error-handling-patterns/SKILL.md +2 -2
  14. package/.agent-src/skills/{repomix → repomix-packer}/SKILL.md +8 -8
  15. package/.agent-src/skills/roadmap-writing/SKILL.md +9 -0
  16. package/.agent-src/skills/rule-writing/SKILL.md +21 -0
  17. package/.agent-src/skills/skill-writing/SKILL.md +19 -0
  18. package/.agent-src/skills/testing-anti-patterns/SKILL.md +7 -0
  19. package/.agent-src/templates/AGENTS.md +9 -10
  20. package/.claude-plugin/marketplace.json +5 -8
  21. package/AGENTS.md +1 -2
  22. package/CHANGELOG.md +86 -0
  23. package/CONTRIBUTING.md +90 -0
  24. package/README.md +3 -3
  25. package/docs/architecture.md +2 -2
  26. package/docs/catalog.md +11 -13
  27. package/docs/contracts/command-clusters.md +20 -3
  28. package/docs/contracts/file-ownership-matrix.json +205 -56
  29. package/docs/getting-started.md +1 -1
  30. package/docs/guidelines/code-clarity.md +95 -0
  31. package/docs/guidelines/php/general.md +8 -0
  32. package/docs/guidelines/php/php-coding-patterns.md +1 -0
  33. package/docs/skills-catalog.md +27 -3
  34. package/llms.txt +26 -2
  35. package/package.json +1 -1
  36. package/scripts/chat_history.py +166 -36
  37. package/scripts/check_command_count_messaging.py +12 -3
  38. package/scripts/check_portability.py +1 -0
  39. package/scripts/lint_agents_md.py +33 -0
  40. package/scripts/release.py +77 -2
  41. package/scripts/skill_linter.py +10 -3
  42. package/.agent-src/commands/agents/cleanup.md +0 -194
  43. package/.agent-src/commands/agents/prepare.md +0 -141
  44. package/.agent-src/commands/copilot-agents/optimize.md +0 -255
  45. package/.agent-src/commands/copilot-agents.md +0 -44
  46. package/.agent-src/commands/optimize/agents.md +0 -144
@@ -1,26 +1,31 @@
1
1
  ---
2
2
  name: agents
3
- description: Agents-folder orchestrator — routes to audit, cleanup, prepare
3
+ description: Agent-layer orchestrator — routes to init, optimize, audit. Covers AGENTS.md and its multi-tool stubs (CLAUDE.md, GEMINI.md, copilot-instructions.md, .cursorrules).
4
4
  cluster: agents
5
5
  disable-model-invocation: true
6
6
  suggestion:
7
7
  eligible: true
8
- trigger_description: "audit agents folder, prepare agents structure, clean up agent docs"
9
- trigger_context: "user wants to inspect, scaffold, or curate the agents/ tree"
8
+ trigger_description: "initialize agent layer, optimize AGENTS.md, audit agent infrastructure, AGENTS.md health-check"
9
+ trigger_context: "user wants to bootstrap, refactor, or health-check the agent layer (AGENTS.md + tool stubs + rules + skills)"
10
10
  ---
11
11
 
12
12
  # /agents
13
13
 
14
- Top-level orchestrator for the `/agents` family. Replaces 3 standalone
15
- commands with a single entry point + sub-command dispatch.
14
+ Top-level orchestrator for the `/agents` family the **file-family
15
+ cluster**: `AGENTS.md`, its multi-tool stubs (`CLAUDE.md`, `GEMINI.md`,
16
+ `.github/copilot-instructions.md`, `.cursorrules`), and the surrounding
17
+ agent infrastructure (rules, skills, pointers).
18
+
19
+ > Looking for `agents/` folder operations (scaffold, folder-audit,
20
+ > folder-cleanup)? Those live under [`/optimize agents-dir`](optimize/agents-dir.md).
16
21
 
17
22
  ## Sub-commands
18
23
 
19
24
  | Sub-command | Routes to | Purpose |
20
25
  |---|---|---|
21
- | `/agents audit` | `commands/agents/audit.md` | Audit `agents/` for outdated docs, duplicates, orphaned overrides |
22
- | `/agents cleanup` | `commands/agents/cleanup.md` | Execute cleanup actions from a prior audit |
23
- | `/agents prepare` | `commands/agents/prepare.md` | Scaffold the `agents/` directory structure |
26
+ | `/agents init` | `commands/agents/init.md` | Bootstrap the agent layer — create `AGENTS.md` + tool stubs from the canonical template |
27
+ | `/agents optimize` | `commands/agents/optimize.md` | Refactor `AGENTS.md` to the Thin-Root contract; propagate to multi-tool stubs |
28
+ | `/agents audit` | `commands/agents/audit.md` | Read-only health check token overhead, rule triggers, AGENTS.md health, stale references |
24
29
 
25
30
  Sub-command names match the locked contract in
26
31
  [`docs/contracts/command-clusters.md`](../docs/contracts/command-clusters.md).
@@ -29,13 +34,13 @@ Sub-command names match the locked contract in
29
34
 
30
35
  1. Parse the user's argument: `/agents <sub-command> [args]`.
31
36
  2. Look up the sub-command in the table above.
32
- 3. Load the body of the routed file and follow its `## Instructions` section
37
+ 3. Load the body of the routed file and follow its `## Steps` section
33
38
  verbatim with the remaining args.
34
39
  4. If the sub-command is unknown or missing, print the table above and ask:
35
40
 
36
- > 1. auditfind outdated docs, duplicates, orphaned overrides
37
- > 2. cleanupexecute actions from a prior audit
38
- > 3. preparescaffold the agents/ tree
41
+ > 1. initbootstrap AGENTS.md + tool stubs
42
+ > 2. optimizerefactor AGENTS.md to the Thin-Root contract
43
+ > 3. auditread-only health check on the agent layer
39
44
 
40
45
  ## Rules
41
46
 
@@ -44,3 +49,5 @@ Sub-command names match the locked contract in
44
49
  - **Do NOT chain sub-commands.** One `/agents <sub>` per turn.
45
50
  - If the user invokes `/agents` with no argument, **show the menu** — do
46
51
  not guess which sub-command they meant.
52
+ - **Edit `.agent-src.uncompressed/` only.** `.agent-src/` and `.augment/`
53
+ regenerate from source.
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: optimize:agents-dir
3
+ cluster: optimize
4
+ sub: agents-dir
5
+ description: Manage the agents/ directory — scaffold, folder-audit, fix. Single command with three modes (--scaffold / --audit / --fix); default = interactive wizard.
6
+ skills: [agents-audit, agent-docs-writing, override-management, module-management]
7
+ disable-model-invocation: true
8
+ suggestion:
9
+ eligible: true
10
+ trigger_description: "scaffold agents folder, audit agents directory, fix agents docs, clean up overrides, prepare module agents"
11
+ trigger_context: "user wants to inspect, scaffold, or curate the agents/ tree (NOT AGENTS.md — that's /agents)"
12
+ ---
13
+
14
+ # /optimize agents-dir
15
+
16
+ One command for everything that touches the **`agents/` folder** — the
17
+ project's prose layer (features, contexts, roadmaps, overrides) and the
18
+ mirror dirs under `app/Modules/*/agents/`. Replaces the legacy three-leaf
19
+ surface (`/agents prepare` + `/agents audit` + `/agents cleanup`) with
20
+ one entry-point and three explicit modes.
21
+
22
+ > **Not for `AGENTS.md`** — the root-level Markdown file and its tool
23
+ > stubs (`CLAUDE.md`, `GEMINI.md`, `copilot-instructions.md`) live under
24
+ > [`/agents`](../agents.md) (`init / optimize / audit`).
25
+
26
+ ## Modes
27
+
28
+ | Flag | Mode | Was | What it does |
29
+ |---|---|---|---|
30
+ | `--scaffold` | scaffold | `/agents prepare` | Create `agents/`, `agents/features/`, `agents/contexts/`, `agents/roadmaps/`, module mirrors, `.gitkeep` files |
31
+ | `--audit` | folder-audit | `/agents audit` | Read-only inventory of `agents/`, module agents, overrides; flag duplicates, orphans, structural drift |
32
+ | `--fix` | fix | `/agents cleanup` | Execute actions from a prior `--audit` (or roadmap) — move, merge, delete, update; per-action confirmation |
33
+
34
+ **No flag → interactive wizard.** Print the table above, ask:
35
+
36
+ ```
37
+ > 1. scaffold — set up the agents/ tree (first-time setup)
38
+ > 2. audit — inventory and find issues
39
+ > 3. fix — execute actions from a prior audit
40
+ ```
41
+
42
+ ## Mode dispatch
43
+
44
+ After a mode is selected, follow the matching procedure verbatim. Each
45
+ mode preserves the behavior of the old leaf command exactly — only the
46
+ surface changes.
47
+
48
+ ### `--scaffold` (was `/agents prepare`)
49
+
50
+ 1. **Verify project root** — look for `composer.json`, `artisan`, or `package.json`.
51
+ 2. **Create directory structure** — `agents/{roadmaps,features,contexts}/.gitkeep` + `.augment/guidelines/php/.gitkeep`. Skip dirs that already exist with content.
52
+ 3. **Module support** — if `app/Modules/` exists, mirror the layout in every module: `app/Modules/{Module}/agents/{roadmaps,features,contexts}/.gitkeep`.
53
+ 4. **Verify templates** — confirm `.augment/templates/{features,roadmaps,contexts}.md` exist; warn on missing.
54
+ 5. **Clean up old templates** — offer to delete legacy `agents/features/template.md` etc. (now in `.augment/templates/`); ask before delete.
55
+ 6. **Show summary** — table with status per directory and template; flag missing as `⚠️`.
56
+
57
+ **Rules:** never overwrite existing files; only add `.gitkeep` to truly empty dirs; ask before deleting old templates.
58
+
59
+ ### `--audit` (was the folder side of `/agents audit`)
60
+
61
+ 1. **Inventory all agent docs** — `find agents/ -maxdepth 1`, `agents/features/`, `agents/contexts/`, `agents/overrides/`, `.augment/guidelines/`, `app/Modules/*/agents/`. For each: filename, first heading, size, last `git log` date.
62
+ 2. **Module coverage** — for every `app/Modules/*/`: docs count, presence of description file, features dir, contexts dir; flag inactive modules with no docs as `🔵 Info` only.
63
+ 3. **Scan overrides** — for every `agents/overrides/*.md`: extract `Mode:` (`extend`/`replace`) and `Original:` headers; check the original file exists; flag orphans.
64
+ 4. **Classify documents** — `Architecture / Convention / Pattern / Feature / Context / Module Doc / Override / Unclear`.
65
+ 5. **Detect issues**:
66
+ - Structural — files in wrong dirs, naming inconsistencies, kebab-case violations.
67
+ - Content — verify class/method/path references against the actual codebase via `codebase-retrieval` or file checks; flag stale references.
68
+ - Duplication — `agents/` ↔ `.augment/skills/`, root ↔ `.augment/guidelines/`, root ↔ module docs.
69
+ - Coverage gaps — active modules without docs, complex areas without contexts.
70
+ 6. **Display audit report** — sectioned table (Inventory · Module Agents · Overrides · Issues · Duplicates · Gaps) with severity buckets `🔴 Critical`, `🟡 Warning`, `🔵 Info`, `⚪ Clean`.
71
+ 7. **Offer improvement roadmap**:
72
+ ```
73
+ > 1. Yes — create agents/roadmaps/agents-cleanup.md
74
+ > 2. Show recommendations only (no file)
75
+ > 3. No — audit was enough
76
+ ```
77
+ Roadmap phases: critical fixes → structural cleanup → fill gaps → cleanup.
78
+ 8. **Offer next steps** — `/optimize agents-dir --fix`, `/context refactor`, or done.
79
+
80
+ **Rules:** read-only — no file edits; do NOT audit `agents/roadmaps/` or `app/Modules/*/agents/roadmaps/` (separate lifecycle); do NOT audit `.augment/` (route to `/agents audit`); be specific (file, reference, what's wrong); don't flag inactive modules.
81
+
82
+ ### `--fix` (was `/agents cleanup`)
83
+
84
+ 1. **Locate the audit roadmap** — most recent `agents/roadmaps/road-to-agents-cleanup*.md` (or named cleanup roadmap from a prior `--audit` run). Missing → recommend `/optimize agents-dir --audit` first; allow `--ad-hoc` only on explicit override.
85
+ 2. **Show action plan** — phases from the roadmap (Critical fixes · Structural cleanup · Fill gaps · Cleanup) with action counts; ask which phase to start.
86
+ 3. **Execute actions** — for each: per-action confirmation, then run the matching workflow:
87
+ - **Move** — move file + update references in `.augment/` skills/commands and other docs.
88
+ - **Merge** — preview merged content, confirm, write merged file, delete originals, update references.
89
+ - **Delete** — preview file, confirm, delete, scrub references.
90
+ - **Update** — apply explicit content changes (remove stale refs, refresh sections, add missing info).
91
+ - **Create context** — hand off to `/context create` with area pre-selected.
92
+ 4. **Update roadmap progress** — flip `[ ]` → `[x]` after each action; show progress bar. Per `verbosity.routine_confirmations`: `false` → continue silently, user can interrupt; `true` → confirm next.
93
+ 5. **Summary** — gated by `verbosity.post_action_reports` (`off` / `minimal` / `full`); minimal = one line counts (moved · merged · deleted · updated · remaining).
94
+
95
+ **Rules:** confirm before every destructive action; always update references when moving/renaming; update the roadmap after each completed action; show file content before delete; check `.augment/` references too.
96
+
97
+ ## What this command does NOT do
98
+
99
+ - **No edits to `AGENTS.md`** or its tool stubs — that's [`/agents optimize`](../agents/optimize.md).
100
+ - **No edits to rules / skills / `.augment/`** — that's [`/agents audit`](../agents/audit.md), `/optimize skills`, or `skill-reviewer`.
101
+ - **No commits, no push, no PR** — finishing is a user decision per
102
+ [`commit-policy`](../../rules/commit-policy.md).
103
+ - **No edits to `.agent-src/` or `.augment/`** — those regenerate from
104
+ `.agent-src.uncompressed/`. Edit the source.
105
+
106
+ ## See also
107
+
108
+ - [`/agents`](../agents.md) — `init / optimize / audit` for `AGENTS.md` and tool stubs.
109
+ - [`agent-docs-writing`](../../skills/agent-docs-writing/SKILL.md) — voice, structure, anchor conventions for prose under `agents/`.
110
+ - [`agents-audit`](../../skills/agents-audit/SKILL.md) — folder-audit heuristics and severity matrix.
111
+ - [`override-management`](../../skills/override-management/SKILL.md) — `extend` vs `replace` semantics and orphan detection.
@@ -1,25 +1,27 @@
1
1
  ---
2
2
  name: optimize
3
- description: Optimize orchestrator — routes to skills, agents, augmentignore, rtk-filters
3
+ description: Optimize orchestrator — routes to skills, agents-dir, augmentignore, rtk-filters
4
4
  cluster: optimize
5
5
  disable-model-invocation: true
6
6
  suggestion:
7
7
  eligible: true
8
- trigger_description: "optimize my skills, audit agents, tune augmentignore, optimize rtk filters"
9
- trigger_context: "maintainer auditing or trimming agent infrastructure"
8
+ trigger_description: "optimize my skills, manage agents directory, tune augmentignore, optimize rtk filters"
9
+ trigger_context: "maintainer auditing or trimming the agent layer (NOT AGENTS.md — that's /agents)"
10
10
  ---
11
11
 
12
12
  # /optimize
13
13
 
14
- Top-level orchestrator for the `/optimize` family. Replaces 4 standalone
15
- commands with a single entry point + sub-command dispatch.
14
+ Top-level orchestrator for the `/optimize` family.
15
+
16
+ > Looking for `AGENTS.md` operations (init, refactor, audit)? Those
17
+ > live under [`/agents`](agents.md) (`init / optimize / audit`).
16
18
 
17
19
  ## Sub-commands
18
20
 
19
21
  | Sub-command | Routes to | Purpose |
20
22
  |---|---|---|
21
23
  | `/optimize skills` | `commands/optimize/skills.md` | Audit skills — measure baseline, find duplicates, run linter |
22
- | `/optimize agents` | `commands/optimize/agents.md` | Audit agent infrastructuretoken overhead, rule triggers, AGENTS.md |
24
+ | `/optimize agents-dir` | `commands/optimize/agents-dir.md` | Manage the `agents/` directory `--scaffold` / `--audit` / `--fix` (interactive wizard if no flag) |
23
25
  | `/optimize augmentignore` | `commands/optimize/augmentignore.md` | Create or refine `.augmentignore` based on actual stack |
24
26
  | `/optimize rtk` | `commands/optimize/rtk.md` | Create or refine project-local rtk filters |
25
27
 
@@ -30,12 +32,12 @@ Sub-command names match the locked contract in
30
32
 
31
33
  1. Parse the user's argument: `/optimize <sub-command> [args]`.
32
34
  2. Look up the sub-command in the table above.
33
- 3. Load the body of the corresponding `commands/optimize-<sub>.md` file and
35
+ 3. Load the body of the corresponding `commands/optimize/<sub>.md` file and
34
36
  follow its `## Steps` (or `## Instructions`) section verbatim.
35
37
  4. If the sub-command is unknown or missing, print the menu and ask:
36
38
 
37
39
  > 1. skills — audit skills (find duplicates, run linter)
38
- > 2. agents — audit agent infrastructure (token overhead, rule triggers)
40
+ > 2. agents-dirscaffold / audit / fix the `agents/` tree
39
41
  > 3. augmentignore — create or refine `.augmentignore`
40
42
  > 4. rtk — create or refine project-local rtk filters
41
43
 
@@ -5,6 +5,12 @@ Full table of available coding guidelines for the
5
5
  holds the obligation surface (always check the relevant guideline
6
6
  before writing or reviewing code); this file is the catalog.
7
7
 
8
+ ## Universal (`docs/guidelines/`)
9
+
10
+ | File | Topic |
11
+ |---|---|
12
+ | `code-clarity.md` | Cross-language clarity rules — inline single-use values, carve-outs (side effects, loops, type narrowing, debugger) |
13
+
8
14
  ## PHP (`docs/guidelines/php/`)
9
15
 
10
16
  | File | Topic |
@@ -4,7 +4,7 @@ Lookup table for the `slash-command-routing-policy` rule. Lists the
4
4
  locked clusters and their sub-commands so the rule itself can stay at
5
5
  its current LOC while still reflecting the full surface. Source of
6
6
  truth for the cluster names is
7
- [`docs/contracts/command-clusters.md`](../../../../../docs/contracts/command-clusters.md);
7
+ [`docs/contracts/command-clusters.md`](../../../../../../docs/contracts/command-clusters.md);
8
8
  this file mirrors that contract for runtime lookup. Linter:
9
9
  `scripts/check_cluster_patterns.py` (verifies dispatcher shape).
10
10
 
@@ -16,14 +16,13 @@ this file mirrors that contract for runtime lookup. Linter:
16
16
  | `/optimize` | 1 | `agents` · `augmentignore` · `rtk` · `skills` | `/optimize-agents` · `/optimize-augmentignore` · `/optimize-rtk-filters` · `/optimize-skills` |
17
17
  | `/feature` | 1 | `explore` · `plan` · `refactor` · `roadmap` | `/feature-explore` · `/feature-plan` · `/feature-refactor` · `/feature-roadmap` |
18
18
  | `/chat-history` | 2 | `show` | `/chat-history` (legacy status) — `resume` / `clear` / `checkpoint` removed in `road-to-chat-history-hook-only` |
19
- | `/agents` | 2 | `audit` · `cleanup` · `prepare` | `/agents-audit` · `/agents-cleanup` · `/agents-prepare` |
19
+ | `/agents` | 2 | `init` · `optimize` · `audit` | `/copilot-agents-init` · merger of `/optimize-agents-md` + `/copilot-agents-optimize` · `/optimize-agents` (folder ops moved to `/optimize:agents-dir`) |
20
20
  | `/memory` | 2 | `add` · `load` · `promote` · `propose` | `/memory-add` · `/memory-full` · `/memory-promote` · `/propose-memory` |
21
21
  | `/roadmap` | 2 | `create` · `process-step` · `process-phase` · `process-full` | `/roadmap-create` · `/roadmap-process` (replaced — autonomous, no per-step gate; `process-phase` is the default execution scope) |
22
22
  | `/module` | 2 | `create` · `explore` | `/module-create` · `/module-explore` |
23
23
  | `/tests` | 2 | `create` · `execute` | `/tests-create` · `/tests-execute` |
24
24
  | `/context` | 2 | `create` · `refactor` | `/context-create` · `/context-refactor` |
25
25
  | `/override` | 2 | `create` · `manage` | `/override-create` · `/override-manage` |
26
- | `/copilot-agents` | 2 | `init` · `optimize` | `/copilot-agents-init` · `/copilot-agents-optimize` |
27
26
  | `/judge` | 2 | `solo` · `on-diff` · `steps` | `/judge` (legacy standalone) · `/do-and-judge` · `/do-in-steps` |
28
27
  | `/commit` | 2 | flag: `--in-chunks` | `/commit:in-chunks` |
29
28
  | `/create-pr` | 2 | flag: `--description-only` | `/create-pr:description-only` |
@@ -0,0 +1,132 @@
1
+ # AGENTS.md Anatomy — outboard reference
2
+
3
+ > Companion context to the
4
+ > [`agents-md-thin-root`](../../skills/agents-md-thin-root/SKILL.md)
5
+ > skill. Holds the long-form anatomy guidance that does not fit
6
+ > inside the skill body without breaching its size budget.
7
+
8
+ ## Iron Law — Capabilities over Structure
9
+
10
+ Every entry in AGENTS.md describes **what the project can do** or
11
+ **where to learn more**, never **where individual files live**.
12
+
13
+ ```
14
+ A FILE PATH WITHOUT A WHY-CLAUSE IS DEAD WEIGHT.
15
+ PATH ENUMERATION (≥ 3 PATHS WITHOUT POINTERS) IS A LINT WARNING.
16
+ ```
17
+
18
+ Path lists rot every refactor; capability lists survive structural
19
+ churn because they describe intent. Concrete substitutions:
20
+
21
+ | Anti-pattern (path enumeration) | Capability rewrite |
22
+ |---|---|
23
+ | `- src/auth/`<br>`- src/auth/jwt.ts`<br>`- src/auth/middleware.ts` | `- **Authentication** — OAuth + JWT session handling: [`src/auth/`](src/auth/)` |
24
+ | `- packages/payments/`<br>`- packages/billing/` | `- **Billing** — Stripe Checkout + invoice generation, dunning + tax: [`docs/billing.md`](docs/billing.md)` |
25
+ | Three bullets listing test directories | One pointer to the testing strategy doc with a *why*-clause |
26
+
27
+ A pointer is **substantive** only if its surrounding sentence carries
28
+ a *why*-clause ≥ 60 chars. Bare paths get filtered out by the lint.
29
+
30
+ ## 1-liner project description slot
31
+
32
+ The first prose line under the project title is the **only place** the
33
+ agent learns what the repo is in one sentence when retrieval is
34
+ degraded. Required content:
35
+
36
+ ```
37
+ > {What it is} — {primary capability} for {audience}, {differentiator}.
38
+ ```
39
+
40
+ ✅ Right: `> Multi-tenant SaaS billing — Stripe-backed subscription
41
+ and invoicing for B2B sellers, audit-grade ledger.`
42
+ ❌ Wrong: `> A modern web app built with Next.js and TypeScript.`
43
+ (stack ≠ capability; an agent already knows what those are.)
44
+
45
+ ## Multi-tool symlink strategy
46
+
47
+ `AGENTS.md` is the canonical entry point. Tool-specific files
48
+ (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`) point at
49
+ the same content via a symlink-or-stub pattern. Two acceptable shapes:
50
+
51
+ **Symlink** (POSIX, monorepo-friendly):
52
+
53
+ ```bash
54
+ ln -s AGENTS.md CLAUDE.md
55
+ ln -s AGENTS.md GEMINI.md
56
+ ln -s AGENTS.md .cursorrules
57
+ ```
58
+
59
+ **Stub** (Windows-safe, generation-pipeline-friendly):
60
+
61
+ ```markdown
62
+ <!-- CLAUDE.md -->
63
+ > See [`AGENTS.md`](AGENTS.md) — single source of truth for agent
64
+ > instructions in this repo.
65
+ ```
66
+
67
+ Do not duplicate AGENTS.md content into the tool-specific files; the
68
+ agent ends up with two diverging versions and the budget is paid
69
+ twice. The package's `task generate-tools` pipeline produces stubs
70
+ deterministically — never hand-edit them.
71
+
72
+ ## Monorepo — per-package AGENTS.md
73
+
74
+ Each top-level package (or app, depending on layout) gets its own
75
+ `AGENTS.md` at the package root, **not** a section inside the
76
+ monorepo-root file. Why:
77
+
78
+ 1. Agents working in `packages/foo/` retrieve the nearest `AGENTS.md`
79
+ first — irrelevant siblings stay out of the budget.
80
+ 2. The monorepo-root `AGENTS.md` becomes a navigation surface that
81
+ points at each package's entry, capability-style:
82
+ `- **Web app** — Next.js storefront and customer dashboard:
83
+ [`apps/web/AGENTS.md`](apps/web/AGENTS.md)`.
84
+ 3. Per-package emergency-triage blocks answer the five canonical
85
+ questions in the package's local idiom (own lint / test entry,
86
+ own source-of-truth path).
87
+
88
+ Anti-pattern: a single 6 KB monorepo `AGENTS.md` with five
89
+ package-specific sections. Spend lives in the wrong budget and every
90
+ package edit touches the same hot file.
91
+
92
+ ## Refactor recipe — bloated AGENTS.md → Thin-Root
93
+
94
+ 1. **Snapshot.** `wc -c AGENTS.md` and stash a copy of the
95
+ pre-refactor file (e.g. `AGENTS.md.before` in your scratch dir)
96
+ so you can diff before / after.
97
+ 2. **Section inventory.** List every `## ` heading + its char-count.
98
+ Mark `keep-inline` (Iron-Law-adjacent, ≤ 200 chars) vs.
99
+ `outboard-candidate`.
100
+ 3. **Path-enumeration sweep.** Find every line that is just a path
101
+ inside backticks with no *why*-clause; collapse runs of three or
102
+ more into a single capability pointer.
103
+ 4. **Outboard.** Move each `outboard-candidate` into
104
+ `agents/contexts/`, `docs/contracts/`, an existing rule body, or
105
+ an existing skill body. Replace in-file with a substantive
106
+ pointer. Never invent a new top-level dir.
107
+ 5. **Verify.** Run `python3 scripts/lint_agents_md.py` until green;
108
+ `wc -c AGENTS.md` ≤ target cap; emergency-triage block intact.
109
+
110
+ ## Common gotchas
111
+
112
+ - **"Quick reference" sections.** A two-line table of common commands
113
+ feels useful but doubles every package release. Outboard to the
114
+ README's quickstart and link with one pointer.
115
+ - **Tech-stack dumps.** "We use React, Tailwind, tRPC, Postgres, …"
116
+ costs budget without unblocking decisions. Move to a single
117
+ `## Stack` pointer at `docs/architecture.md#stack`.
118
+ - **Roadmap snippets.** Roadmaps move every sprint; pin the agent to
119
+ the directory (`agents/roadmaps/`) and let it discover the active
120
+ one rather than naming the current file.
121
+ - **Per-feature subsections.** "How auth works", "How billing works"
122
+ belong in capability docs, not in the root entry. AGENTS.md
123
+ references them with one *why*-clause line each.
124
+
125
+ ## See also
126
+
127
+ - [`agents-md-thin-root`](../../skills/agents-md-thin-root/SKILL.md)
128
+ — caps, pointer-ratio, pointer-anatomy, emergency-triage contract.
129
+ - [`emergency-triage-block`](emergency-triage-block.md) — canonical
130
+ source for the five-question block both AGENTS.md variants embed.
131
+ - [`consumer-agents-md-guide`](consumer-agents-md-guide.md) — section
132
+ templates a consumer fills in after install.
@@ -31,6 +31,10 @@ Use when:
31
31
 
32
32
  Augment Code injects `AGENTS.md` verbatim into every workspace prompt. Each kilobyte spent here permanently consumes the 49,512-char workspace-guidelines budget shared with always-rules and auto-rule registry stubs. The Thin-Root pattern keeps the entry point a navigation surface (pointers + intent) and pushes deep detail into files Augment loads on demand via `load_context` or that other tools fetch only when their search retrieves them. Strategic council R2 (2026-05-08, Sonnet 4.5 / Opus 4.1 / gpt-4o / o1) converged on the contract codified below as the minimum guard against AGENTS.md re-bloat.
33
33
 
34
+ ## Iron Law — Capabilities over Structure
35
+
36
+ Every entry describes **what** the project does or **where** to learn more — never **where** individual files live. Path lists rot every refactor and poison context; capability pointers survive structural churn. Full anatomy with rewrite recipes, monorepo guidance, and multi-tool symlink strategy: [`agents-md-anatomy`](../../contexts/contracts/agents-md-anatomy.md).
37
+
34
38
  ## The contract — hard caps
35
39
 
36
40
  | File | FAIL above | WARN above | Target |
@@ -106,6 +110,8 @@ Same procedure, applied to `.agent-src.uncompressed/templates/AGENTS.md`. Hard c
106
110
  - **Emergency-triage drift.** Editing the in-file emergency-triage block instead of the canonical `.agent-src.uncompressed/contexts/contracts/emergency-triage-block.md` causes the package-root and consumer-template versions to diverge silently. Always edit the canonical file and let the lint diff pull both back in sync.
107
111
  - **Cap inversion under WARN.** A 2,250-char AGENTS.md (above 2,200 WARN, below 2,500 FAIL) is a yellow signal not a green one — every additional sentence raises the probability of the next FAIL. Treat WARN as the spend boundary, not a buffer.
108
112
  - **Char-count includes frontmatter.** `wc -c` counts every byte including the YAML preamble, blank lines, and the trailing newline. Stripping a section to "look smaller" without re-running `wc -c` understates the true budget impact.
113
+ - **Path enumeration.** A run of three or more bare `` `path/to/dir/` `` bullets without *why*-clauses is the classic re-bloat pattern. The lint emits a WARN at ≥ 3 such lines. Collapse them into one capability-style pointer — see the recipe in [`agents-md-anatomy § Iron Law`](../../contexts/contracts/agents-md-anatomy.md#iron-law--capabilities-over-structure).
114
+ - **Tool-specific duplicates.** Copy-pasting AGENTS.md into `CLAUDE.md` / `GEMINI.md` / `.cursorrules` doubles the budget cost across tools. Use the symlink-or-stub pattern in [`agents-md-anatomy § Multi-tool symlink strategy`](../../contexts/contracts/agents-md-anatomy.md#multi-tool-symlink-strategy) instead.
109
115
 
110
116
  ## Output format
111
117
 
@@ -119,7 +125,8 @@ When invoked as a planning step, produce:
119
125
 
120
126
  ## See also
121
127
 
122
- - [`copilot-agents-optimization`](../copilot-agents-optimization/SKILL.md) — sibling skill for `.github/copilot-instructions.md`; runs alongside Thin-Root in `/optimize/agents`.
128
+ - [`agents-md-anatomy`](../../contexts/contracts/agents-md-anatomy.md) — Capabilities-over-Structure Iron Law, multi-tool symlink strategy, monorepo per-package layout, refactor recipe, full gotcha catalog.
129
+ - [`copilot-agents-optimization`](../copilot-agents-optimization/SKILL.md) — sibling skill for `.github/copilot-instructions.md`; runs alongside Thin-Root in `/agents optimize`.
123
130
  - [`agent-docs-writing`](../agent-docs-writing/SKILL.md) — broader documentation-structure context for navigating outboard targets.
124
131
  - [`size-enforcement`](../../rules/size-enforcement.md) — covers per-skill / per-rule / per-command size budgets; AGENTS.md caps live in this skill instead.
125
132
  - [`ADR-004-rule-governance-pruning`](../../../docs/decisions/ADR-004-rule-governance-pruning.md) — captures the rule-governance pruning that freed the workspace-guidelines budget; the Thin-Root caps build on that headroom.
@@ -32,6 +32,35 @@ A command is **user-invoked** and carries `disable-model-invocation: true`.
32
32
  A skill is model-invoked via description routing. If both audiences apply,
33
33
  author as a skill and add a thin command that delegates to it.
34
34
 
35
+ ## Commands ARE Claude skills (projection reality)
36
+
37
+ Every `.agent-src.uncompressed/commands/{name}.md` projects to
38
+ `.claude/skills/{slug}/SKILL.md` via `scripts/compress.py`
39
+ (`generate_claude_commands`). Nested commands flatten with `-`
40
+ (`council/default.md` → `council-default`). Skills + commands share the
41
+ **same `.claude/skills/` namespace** — Claude does not distinguish them.
42
+
43
+ Authoring consequences:
44
+
45
+ * Frontmatter `description` is Claude's **routing surface**. Generic
46
+ phrasing → undertriggering even with `disable-model-invocation: true`,
47
+ because the in-host suggester, fuzzy search, and any tooling that
48
+ scans `.claude/skills/` ranks by description match.
49
+ * `disable-model-invocation: true` blocks **automatic** invocation only.
50
+ It does NOT remove the command from discovery surfaces. Weak
51
+ description = invisible to the suggester even when intent matches.
52
+ * Trigger phrasing follows the same Iron Law as skill descriptions:
53
+ name 2+ trigger classes (domains, symptoms, user phrasing), end with
54
+ the `... even when the user just says ...` tail, ≤ 200 chars. See
55
+ `skill-writing` § 1b for the canonical before/after.
56
+ * `suggestion.trigger_description` / `suggestion.trigger_context` are
57
+ **separate** from frontmatter `description` — they drive the in-host
58
+ suggester (`command-suggestion-policy`), not Claude's skill router.
59
+ Both matter, both must be precise.
60
+
61
+ Bottom line: write the command's `description` as if a skill router
62
+ will read it — because one will.
63
+
35
64
  ## Procedure
36
65
 
37
66
  ### 0. Run the Drafting Protocol
@@ -149,6 +178,26 @@ multi-paragraph explanation, extract it into a skill and call it.
149
178
  * Run the full CI pipeline locally (see `Taskfile.yml` in this repo for
150
179
  the script list) — must exit 0 except for tolerated warnings.
151
180
 
181
+ ### 6. Governance baseline (when introducing a new linter check)
182
+
183
+ **Advisory, reviewer-checked — no CI gate.** When the same PR adds a
184
+ new check to `scripts/skill_linter.py` (or strengthens an existing one)
185
+ such that previously-clean commands now warn, the PR body MUST record
186
+ the pre-existing violations on `main` in a Markdown table:
187
+
188
+ ```markdown
189
+ ### Pre-existing baseline (informational)
190
+
191
+ | Code | Count on main | Bucket |
192
+ |---|---:|---|
193
+ | {new_code} | N | (a) genuine fix · (b) accept · (c) check too aggressive |
194
+ ```
195
+
196
+ Forward-only: the new check applies to **the file under review** and to
197
+ **future** edits. The baseline table is informational so reviewers can
198
+ spot intent (fix-now vs. backlog) without diffing the full lint output.
199
+ See `agents/analysis/lint-warning-triage.md` for the 3-bucket reference.
200
+
152
201
  ## Output format
153
202
 
154
203
  1. Complete command file at `.agent-src.uncompressed/commands/{name}.md`
@@ -166,7 +166,7 @@ prevent. Fix or remove those BEFORE any dedup/compress work — there's
166
166
  no point deduplicating content that is about to be rewritten.
167
167
 
168
168
  When the drift is severe (whole sections are wrong), recommend
169
- `/copilot-agents-init` to scaffold a clean replacement rather than
169
+ `/agents init` to scaffold a clean replacement rather than
170
170
  patching forever.
171
171
 
172
172
  ## agent-config Path Conventions — Preserve, Don't "Fix"
@@ -189,7 +189,7 @@ it as "redundant" and never trim its bullets. The patterns it covers:
189
189
  If the consumer project's `copilot-instructions.md` is missing the
190
190
  section, **add it** during optimization using the canonical block
191
191
  from `.augment/templates/copilot-instructions.md`. Surfaces include
192
- `/copilot-agents init` and `/copilot-agents optimize`.
192
+ `/agents init` and `/agents optimize`.
193
193
 
194
194
  ## Optimization Checklist
195
195
 
@@ -212,7 +212,7 @@ When optimizing either file, check:
212
212
 
213
213
  ## Related
214
214
 
215
- - **Command:** `/copilot-agents-optimize`
215
+ - **Command:** `/agents optimize`
216
216
  - **Skill:** `copilot-config` — Copilot behavior and PR review patterns
217
217
  - **Skill:** `agent-docs-writing` — documentation hierarchy
218
218
  - **Context:** `augment-infrastructure.md` — full `.augment/` overview
@@ -80,8 +80,8 @@ Exactly **one** layer translates internal errors to the egress format (HTTP stat
80
80
 
81
81
  ## Procedure: Apply the framework to a new feature
82
82
 
83
- 1. List failure modes (each external call, each invariant, each user input class).
84
- 2. Run Step 1 against each, write the classification next to it.
83
+ 1. **Inspect** the feature surface — identify every failure mode (each external call, each invariant, each user input class) and write it down.
84
+ 2. Run Step 1 of the decision framework against each entry; write the classification next to it.
85
85
  3. Pick reporting mechanism per Step 2; reject combinations the language idiom rejects.
86
86
  4. For each external call, run Step 3 and write down the chosen resilience strategy.
87
87
  5. Sketch the error payload shape (Step 4) and the single boundary (Step 5).
@@ -1,12 +1,12 @@
1
1
  ---
2
- name: repomix
2
+ name: repomix-packer
3
3
  description: "Use when packaging a codebase to a single AI-friendly file for LLM analysis — local or remote, XML/Markdown/JSON, token counting, gitignore filtering, peer-side `repomix` CLI."
4
4
  source: package
5
5
  ---
6
6
 
7
7
  > **Pinned upstream:** `repomix` CLI (npm: `repomix`, brew: `repomix`). Re-verify per minor bump. Repomix is an **optional dependency** — this skill never installs it silently.
8
8
 
9
- # repomix
9
+ # repomix-packer
10
10
 
11
11
  Wraps the upstream [`yamadashy/repomix`](https://github.com/yamadashy/repomix) CLI for codebase-snapshot workflows: pack a local or remote repo into a single XML / Markdown / JSON file with token counts and secret detection, then feed it to an LLM for review, audit, or migration scoping.
12
12
 
@@ -25,7 +25,7 @@ Do NOT use when:
25
25
 
26
26
  ## Procedure: Snapshot a repo for LLM review
27
27
 
28
- ### Step 0: Verify repomix is installed (peer-side)
28
+ ### 1. Inspect: verify `repomix` is installed (peer-side)
29
29
 
30
30
  ```bash
31
31
  repomix --version
@@ -41,7 +41,7 @@ npm install -g repomix
41
41
  brew install repomix
42
42
  ```
43
43
 
44
- ### Step 1: Decide local vs remote
44
+ ### 2. Decide local vs remote
45
45
 
46
46
  ```bash
47
47
  # Local: pack the current directory.
@@ -54,7 +54,7 @@ npx repomix --remote owner/repo
54
54
  npx repomix --remote https://github.com/owner/repo/commit/<sha>
55
55
  ```
56
56
 
57
- ### Step 2: Filter the snapshot to the smallest useful slice
57
+ ### 3. Filter the snapshot to the smallest useful slice
58
58
 
59
59
  ```bash
60
60
  # Include patterns
@@ -67,7 +67,7 @@ repomix -i "tests/**,*.test.js"
67
67
  repomix --remove-comments
68
68
  ```
69
69
 
70
- ### Step 3: Pick the output format and destination
70
+ ### 4. Pick the output format and destination
71
71
 
72
72
  ```bash
73
73
  repomix --style markdown -o snapshot.md # human-readable
@@ -76,7 +76,7 @@ repomix --style json -o snapshot.json # programmatic post-processing
76
76
  repomix --copy # also copy to clipboard
77
77
  ```
78
78
 
79
- ### Step 4: Verify token budget and secrets
79
+ ### 5. Verify token budget and secrets
80
80
 
81
81
  Repomix prints per-file and total token counts and runs Secretlint on the output. Check the totals against the target LLM context window:
82
82
 
@@ -88,7 +88,7 @@ Repomix prints per-file and total token counts and runs Secretlint on the output
88
88
 
89
89
  If Secretlint flags anything, STOP — sanitize the input or add the offending paths to `.repomixignore` before re-packing. Never use `--no-security-check` on an unfamiliar codebase.
90
90
 
91
- ### Step 5: Hand the snapshot to the consumer skill
91
+ ### 6. Hand the snapshot to the consumer skill
92
92
 
93
93
  Most workflows that call this skill pass the snapshot to:
94
94
 
@@ -131,6 +131,11 @@ to every roadmap you author.
131
131
  template rule 13 + [`scope-control`](../../rules/scope-control.md#git-operations--permission-gated).
132
132
  * Plan automatic branch switches mid-roadmap (template rule 14).
133
133
  * Ship a phase without checkboxes (`roadmap-progress-sync` Iron Law #2).
134
+ * Write merge, push, or commit steps into the roadmap. Roadmaps plan
135
+ **work**; merge / push / commit are delivery decisions owned by the
136
+ user (`commit-policy` Iron Law). A roadmap is "implementation-complete"
137
+ once its checkboxes are ticked and verification has been run — merge
138
+ timing is tracked outside the roadmap.
134
139
  * Use ALL-CAPS Iron-Law fenced blocks — those belong in
135
140
  [`kernel-membership`](../../../docs/contracts/kernel-membership.md)-listed
136
141
  rules, not roadmaps.
@@ -149,6 +154,10 @@ to every roadmap you author.
149
154
  - **Author-during-execution branch switches** — the agent should not
150
155
  propose a new branch mid-roadmap; that decision is fenced to
151
156
  authoring time.
157
+ - **Merge / commit steps in roadmap body** — checkboxes like
158
+ "merge PR #X" or "commit phase Y" couple roadmap closure to git
159
+ operations the user has not authorized. Roadmap completion is
160
+ decoupled from delivery; ship-the-PR is its own decision.
152
161
 
153
162
  ## Examples
154
163