@event4u/agent-config 1.29.0 → 1.32.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 (65) 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/feature-planning/SKILL.md +43 -7
  15. package/.agent-src/skills/judge-test-coverage/SKILL.md +4 -0
  16. package/.agent-src/skills/pest-testing/SKILL.md +13 -6
  17. package/.agent-src/skills/quality-tools/SKILL.md +4 -0
  18. package/.agent-src/skills/refine-prompt/SKILL.md +10 -0
  19. package/.agent-src/skills/refine-ticket/SKILL.md +12 -0
  20. package/.agent-src/skills/{repomix → repomix-packer}/SKILL.md +8 -8
  21. package/.agent-src/skills/roadmap-writing/SKILL.md +9 -0
  22. package/.agent-src/skills/rule-writing/SKILL.md +21 -0
  23. package/.agent-src/skills/skill-writing/SKILL.md +19 -0
  24. package/.agent-src/skills/subagent-orchestration/SKILL.md +77 -12
  25. package/.agent-src/skills/subagent-orchestration/prompts/README.md +29 -0
  26. package/.agent-src/skills/subagent-orchestration/prompts/do-and-judge-two-stage.md +121 -0
  27. package/.agent-src/skills/subagent-orchestration/prompts/do-and-judge.md +60 -0
  28. package/.agent-src/skills/subagent-orchestration/prompts/do-competitively.md +65 -0
  29. package/.agent-src/skills/subagent-orchestration/prompts/do-in-parallel.md +62 -0
  30. package/.agent-src/skills/subagent-orchestration/prompts/do-in-steps.md +62 -0
  31. package/.agent-src/skills/subagent-orchestration/prompts/do-in-worktrees.md +70 -0
  32. package/.agent-src/skills/subagent-orchestration/prompts/judge-with-debate.md +63 -0
  33. package/.agent-src/skills/subagent-orchestration/schemas/subagent-status.json +63 -0
  34. package/.agent-src/skills/test-driven-development/SKILL.md +25 -13
  35. package/.agent-src/skills/testing-anti-patterns/SKILL.md +14 -0
  36. package/.agent-src/skills/testing-anti-patterns/process-anti-patterns.md +67 -0
  37. package/.agent-src/templates/AGENTS.md +9 -10
  38. package/.claude-plugin/marketplace.json +5 -8
  39. package/AGENTS.md +1 -2
  40. package/CHANGELOG.md +110 -0
  41. package/CONTRIBUTING.md +90 -0
  42. package/README.md +3 -3
  43. package/docs/architecture.md +2 -2
  44. package/docs/catalog.md +12 -14
  45. package/docs/contracts/command-clusters.md +20 -3
  46. package/docs/contracts/file-ownership-matrix.json +546 -56
  47. package/docs/getting-started.md +1 -1
  48. package/docs/guidelines/code-clarity.md +95 -0
  49. package/docs/guidelines/php/general.md +8 -0
  50. package/docs/guidelines/php/php-coding-patterns.md +1 -0
  51. package/docs/skills-catalog.md +27 -3
  52. package/llms.txt +26 -2
  53. package/package.json +1 -1
  54. package/scripts/chat_history.py +166 -36
  55. package/scripts/check_bite_sized_granularity.py +99 -0
  56. package/scripts/check_command_count_messaging.py +12 -3
  57. package/scripts/check_portability.py +1 -0
  58. package/scripts/lint_agents_md.py +33 -0
  59. package/scripts/release.py +77 -2
  60. package/scripts/skill_linter.py +10 -3
  61. package/.agent-src/commands/agents/cleanup.md +0 -194
  62. package/.agent-src/commands/agents/prepare.md +0 -141
  63. package/.agent-src/commands/copilot-agents/optimize.md +0 -255
  64. package/.agent-src/commands/copilot-agents.md +0 -44
  65. 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).
@@ -67,7 +67,7 @@ Explore → Plan → Refine → Roadmap → Implement
67
67
  ### Full workflow (complex features, 7 phases)
68
68
 
69
69
  Use the full workflow for features that span multiple files, require architecture decisions,
70
- or have unclear requirements. Trigger with `/feature-dev`.
70
+ or have unclear requirements. Trigger with `/feature:dev`.
71
71
 
72
72
  ```
73
73
  Discovery → Exploration → Questions → Architecture → Implementation → Review → Summary
@@ -100,7 +100,7 @@ Discovery → Exploration → Questions → Architecture → Implementation →
100
100
  - **Wait for answers before proceeding.**
101
101
 
102
102
  #### Phase 4: Architecture Design
103
- - Design 2-3 impl approaches with different tradeoffs:
103
+ - Design 2-3 implementation approaches with different tradeoffs:
104
104
  - **Minimal changes** — smallest change, maximum reuse.
105
105
  - **Clean architecture** — maintainability, elegant abstractions.
106
106
  - **Pragmatic balance** — speed + quality.
@@ -114,7 +114,7 @@ Discovery → Exploration → Questions → Architecture → Implementation →
114
114
  - Track progress via task list or roadmap.
115
115
 
116
116
  #### Phase 6: Quality Review
117
- - Review the impl for:
117
+ - Review the implementation for:
118
118
  - Simplicity, DRY, elegance.
119
119
  - Bugs and correctness.
120
120
  - Convention adherence.
@@ -136,9 +136,45 @@ Maintain a running **decision log** throughout the planning process. For each de
136
136
  Include the decision log in the feature plan file under a `## Decisions` section.
137
137
  This ensures future developers (and agents) understand the reasoning, not just the outcome.
138
138
 
139
+ ## Bite-sized task granularity (structural roadmaps only)
140
+
141
+ When a feature plan's generated roadmap declares `complexity: structural` in its frontmatter, every task bullet must be self-contained and 2–5 minutes of work. Lightweight roadmaps (the default) skip this section — coarse-grained tasks ("Add login endpoint", "Update tests") are correct when the work is well-scoped and low-risk.
142
+
143
+ Structural roadmap tasks must include:
144
+
145
+ 1. **Exact file path** — `app/Modules/Auth/Services/LoginService.php`, never *"the login service"*.
146
+ 2. **Complete code** — every method body, import, and signature ready to paste; no `// existing code` ellipses, no `…`.
147
+ 3. **Exact command** — `php artisan migrate --path=database/migrations/2026_05_09_create_logins.php`, never *"run the migration"*.
148
+ 4. **Expected output** — what success looks like (`Migrated: 2026_05_09_create_logins`) and the exit code.
149
+ 5. **No placeholders** — angle-bracket placeholders, `TODO`, `FIXME`, `tbd`, and `???` are blockers; resolve before the task ships.
150
+
151
+ The complexity flag lives in the roadmap's YAML frontmatter:
152
+
153
+ ```yaml
154
+ ---
155
+ complexity: structural # triggers bite-sized granularity
156
+ # or
157
+ complexity: lightweight # default — skips bite-sized granularity
158
+ ---
159
+ ```
160
+
161
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Task Structure + § No Placeholders (v5.1.0); complexity-gating is our addition (Council Round 1, Q4 — mitigates UX pushback for senior engineers on well-scoped work).
162
+
163
+ ## Self-review (3-scan checklist)
164
+
165
+ Before presenting any plan, run these three scans in order. Each is a fast pass — not a deep review. Failures block presentation; fix and re-scan.
166
+
167
+ 1. **Spec coverage** — every requirement, AC bullet, or constraint from the input has a corresponding section / AC / scope item in the plan. Walk the input top-to-bottom; tick each requirement against the plan; missing items become open questions or new AC.
168
+ 2. **Placeholder / TODO scan** — grep the draft for `<placeholder>`, `TODO`, `FIXME`, `tbd`, `???`, `XXX`. Either resolve them now or surface them in the *Open questions* section. No placeholder ships unflagged.
169
+ 3. **Type / shape consistency** — proposed data structures, API shapes, file paths, and module names match existing codebase patterns. Cite at least one existing file per new structure as the convention anchor.
170
+
171
+ This scan is **separate from** adversarial-review (below). Self-review catches mechanical gaps (missing AC, leftover placeholders, mis-shaped types); adversarial-review challenges the plan's reasoning.
172
+
173
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Self-Review (v5.1.0).
174
+
139
175
  ## Adversarial self-review
140
176
 
141
- After completing a plan, run the **`adversarial-review`** skill before presenting it.
177
+ After the 3-scan self-review passes, run the **`adversarial-review`** skill before presenting.
142
178
  Focus on the "Feature plans / Architecture" attack questions. See that skill for the full process.
143
179
 
144
180
  ## Feature plan format
@@ -183,7 +219,7 @@ module's `agents/` directory:
183
219
  Before creating a feature plan, always:
184
220
  1. **Search the codebase** for related code, existing patterns, and affected areas.
185
221
  2. **Read module docs** if the feature touches a specific module.
186
- 3. **Check existing features** in `agents/features/` for overlap or deps.
222
+ 3. **Check existing features** in `agents/features/` for overlap or dependencies.
187
223
 
188
224
  ### Be collaborative
189
225
 
@@ -194,7 +230,7 @@ Before creating a feature plan, always:
194
230
 
195
231
  ### Keep it navigational
196
232
 
197
- Feature plans are decision documents, not impl guides.
233
+ Feature plans are decision documents, not implementation guides.
198
234
  Implementation details belong in roadmaps.
199
235
 
200
236
  ## Output format
@@ -221,6 +257,6 @@ Implementation details belong in roadmaps.
221
257
 
222
258
  - Do NOT create feature plans without user input — always collaborate.
223
259
  - Do NOT skip codebase research — always check what exists.
224
- - Do NOT put impl steps in the feature plan — that's the roadmap's job.
260
+ - Do NOT put implementation steps in the feature plan — that's the roadmap's job.
225
261
  - Do NOT commit or push without permission.
226
262
  - Do NOT duplicate information from `AGENTS.md` or module docs.