@hopla/claude-setup 1.17.0 → 1.19.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.
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "hopla",
11
11
  "description": "Agentic coding system: PIV loop, TDD, debugging, brainstorming, subagent execution, and team workflows",
12
- "version": "1.17.0",
12
+ "version": "1.19.0",
13
13
  "source": "./",
14
14
  "author": {
15
15
  "name": "Hopla Tools",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hopla",
3
3
  "description": "Agentic coding system for Claude Code: PIV loop (Plan → Implement → Validate), TDD, debugging, brainstorming, subagent execution, and team workflows",
4
- "version": "1.17.0",
4
+ "version": "1.19.0",
5
5
  "author": {
6
6
  "name": "Hopla Tools",
7
7
  "email": "julio@hopla.tools"
package/README.md CHANGED
@@ -101,6 +101,8 @@ Removes `~/.claude/CLAUDE.md` plus legacy `hopla-*` files from older installs.
101
101
  | `claude-setup --force` | Install without prompts |
102
102
  | `claude-setup --migrate` | Remove legacy CLI-installed duplicates only |
103
103
  | `claude-setup --uninstall` | Remove global rules + legacy files |
104
+ | `claude-setup status` | Read-only inspection of the current project's `.agents/` workflow state (plans, specs, reviews, suggested next step) |
105
+ | `claude-setup status --json` | Same as above, JSON output for agents to parse |
104
106
  | `claude-setup --dry-run` | Preview changes without touching disk (composes with other flags) |
105
107
  | `claude-setup --version` | Print package version |
106
108
 
@@ -140,14 +142,17 @@ Skills and commands use short names in source (e.g., `prime`, `execute`, `git`).
140
142
 
141
143
  ## How It Works — Layered Context
142
144
 
143
- The system uses three levels of CLAUDE.md, each scoped differently:
145
+ The system uses three levels of agent context, each scoped differently:
144
146
 
145
147
  ```
146
148
  ~/.claude/CLAUDE.md ← Machine-level (installed by CLI)
147
149
  └── applies to ALL projects on this machine
148
150
 
149
- CLAUDE.md (project root) ← Project-level (created with /hopla:init-project)
150
- └── applies to THIS project only
151
+ AGENTS.md (project root) ← Project-level (created with /hopla:init-project)
152
+ └── canonical, tool-agnostic rules — applies to THIS project only
153
+ └── readable by Cursor, Copilot, Continue, Codex, and Claude Code
154
+ CLAUDE.md (project root) ← thin alias that imports AGENTS.md via @AGENTS.md
155
+ └── kept so Claude Code's auto-discovery finds the rules
151
156
 
152
157
  .claude/CLAUDE.local.md ← Local overrides (personal, gitignored)
153
158
  └── your personal tweaks, not shared with team
@@ -155,7 +160,7 @@ CLAUDE.md (project root) ← Project-level (created with /hopla:init-project)
155
160
 
156
161
  **Machine-level rules** cover: language preferences, tech defaults, autonomy behavior, context management tips.
157
162
 
158
- **Project-level rules** cover: specific stack versions, architecture patterns, naming conventions, logging, testing, dev commands, task-specific reference guides.
163
+ **Project-level rules** cover: specific stack versions, architecture patterns, naming conventions, logging, testing, dev commands, task-specific reference guides. Stored in `AGENTS.md` so the project stays portable across AI assistants. The `CLAUDE.md` stub at the project root is auto-generated and only contains `@AGENTS.md` so Claude Code inlines the canonical file — never edit the stub directly.
159
164
 
160
165
  **Local overrides** cover: personal preferences that differ from the team (e.g., verbose logging, different editor settings).
161
166
 
@@ -207,7 +212,7 @@ After each PIV loop, run the `execution-report` skill + `/hopla:system-review` t
207
212
 
208
213
  | Command | Description |
209
214
  |---|---|
210
- | `init-project` | Read PRD, recommend stack, create CLAUDE.md and .agents/ structure |
215
+ | `init-project` | Read PRD, recommend stack, create AGENTS.md (+ CLAUDE.md alias) and .agents/ structure |
211
216
  | `create-prd` | Create a Product Requirements Document through guided questions |
212
217
  | `plan-feature` | Research codebase and create a structured implementation plan |
213
218
  | `review-plan` | Review a plan before execution — get a summary and approve |
@@ -215,6 +220,7 @@ After each PIV loop, run the `execution-report` skill + `/hopla:system-review` t
215
220
  | `validate` | Run the validation pyramid: lint → types → tests → integration |
216
221
  | `code-review-fix` | Fix issues found in a code review report |
217
222
  | `rca` | Root Cause Analysis — investigate a bug and generate an RCA doc |
223
+ | `archive` | Close the lifecycle of a completed plan: fold its delta-specs into canonical specs, move artifacts to archive locations |
218
224
  | `guide` | 4D Framework walkthrough for non-technical users |
219
225
  | `system-review` | Analyze implementation against plan to find process improvements |
220
226
 
@@ -238,6 +244,7 @@ After each PIV loop, run the `execution-report` skill + `/hopla:system-review` t
238
244
  | `migration` | "migrate", "upgrade", "switch from X to Y", "major version bump" |
239
245
  | `subagent-execution` | "use subagents", plans with 5+ tasks |
240
246
  | `parallel-dispatch` | "run in parallel", "parallelize this", independent tasks |
247
+ | `hook-audit` | "audit hook", "check hook", "hook review" — mechanical static audit of `src/hooks/use*.ts` files (memoization, stale-id guards, error-match strictness, cache+dedup integrity) |
241
248
 
242
249
  **Hooks** — Run automatically:
243
250
 
@@ -292,6 +299,7 @@ After each PIV loop, run the `execution-report` skill + `/hopla:system-review` t
292
299
  "review the code" → code-review skill runs automatically
293
300
  /hopla:code-review-fix → fix issues found
294
301
  "generate the report" → execution-report skill documents what was built
302
+ /hopla:archive → fold delta-specs into canonical specs, move plan to done/, drop ephemeral code-review (opt-in — when delta-specs were declared)
295
303
  "commit this" → git skill handles commits and PRs
296
304
  (cleanup including worktree removal happens post-merge)
297
305
  ```
@@ -434,12 +442,15 @@ Issues and contributions welcome: https://github.com/HOPLAtools/claude-setup/iss
434
442
  ```
435
443
  project/
436
444
  ├── PRD.md ← Product scope (from /hopla:create-prd)
437
- ├── CLAUDE.md ← Project rules and stack (from /hopla:init-project)
445
+ ├── AGENTS.md ← Canonical project rules (tool-agnostic, from /hopla:init-project)
446
+ ├── CLAUDE.md ← Thin alias: contains @AGENTS.md so Claude Code auto-loads the rules
438
447
  ├── .agents/
439
448
  │ ├── plans/ ← Implementation plans (commit)
440
- │ │ ├── done/ ← Archived plans after system-review (commit)
449
+ │ │ ├── done/ ← Plans archived by /hopla:archive (commit)
441
450
  │ │ └── backlog/ ← Deferred ideas from Scope Guard (commit)
442
451
  │ ├── specs/ ← Design specs from brainstorming (commit)
452
+ │ │ ├── canonical/ ← "Current behavior" specs by domain — populated incrementally by /hopla:archive (commit; opt-in)
453
+ │ │ └── archived/ ← Completed design specs moved here by /hopla:archive (commit)
443
454
  │ ├── guides/ ← On-demand reference guides (commit)
444
455
  │ ├── rca/ ← Root cause analysis docs (commit)
445
456
  │ ├── execution-reports/ ← Post-implementation reports (commit)
@@ -22,7 +22,7 @@ You are a System Reviewer. Your job is to analyze how well the implementation ma
22
22
 
23
23
  | Pattern | Action |
24
24
  |---------|--------|
25
- | Issue appears in ALL features | Update CLAUDE.md |
25
+ | Issue appears in ALL features | Update AGENTS.md (or CLAUDE.md) |
26
26
  | Issue appears in one CLASS of features | Update the specific command |
27
27
  | Same manual step repeated 3+ times | Create a new command |
28
28
  | Plan ambiguous at same point twice | Update planning command |
@@ -47,7 +47,7 @@ Save to `.agents/system-reviews/[feature-name].md`:
47
47
 
48
48
  ## Recommended Improvements
49
49
 
50
- ### CLAUDE.md Updates
50
+ ### AGENTS.md / CLAUDE.md Updates
51
51
  - [Specific changes to project rules]
52
52
 
53
53
  ### Command Updates
@@ -65,12 +65,12 @@ Save to `.agents/system-reviews/[feature-name].md`:
65
65
  ## Recommendation Tracking
66
66
 
67
67
  For each recommendation from the 2 most recent system reviews:
68
- - Was it applied? (Check CLAUDE.md, commands, guides for the suggested change)
68
+ - Was it applied? (Check AGENTS.md / CLAUDE.md, commands, guides for the suggested change)
69
69
  - If not applied, why? (Forgotten, deprioritized, or superseded?)
70
70
  - **Recurring unapplied recommendations indicate a broken feedback loop** — escalate these by listing them first in "Recommended Improvements" with a ⚠️ prefix
71
71
 
72
72
  ## Next Step
73
73
 
74
74
  After the review is saved, suggest:
75
- > "System review saved to `.agents/system-reviews/[feature]-review.md`. Plan archived. If recurring recommendations were found, consider applying them before the next feature — they represent known gaps in the process."
75
+ > "System review saved to `.agents/system-reviews/[feature]-review.md`. To close the lifecycle of this plan, run `/hopla:archive <plan-path>` — it will fold any delta-specs into the canonical specs and move the plan to `done/`. If recurring recommendations were found, consider applying them before the next feature — they represent known gaps in the process."
76
76
  ```
package/cli.js CHANGED
@@ -4,12 +4,15 @@ import fs from "fs";
4
4
  import path from "path";
5
5
  import os from "os";
6
6
  import readline from "readline";
7
+ import { execSync } from "child_process";
7
8
 
8
9
  const FORCE = process.argv.includes("--force");
9
10
  const UNINSTALL = process.argv.includes("--uninstall");
10
11
  const MIGRATE = process.argv.includes("--migrate");
11
12
  const VERSION = process.argv.includes("--version") || process.argv.includes("-v");
12
13
  const DRY_RUN = process.argv.includes("--dry-run");
14
+ const STATUS = process.argv.includes("status");
15
+ const JSON_OUT = process.argv.includes("--json");
13
16
 
14
17
  if (VERSION) {
15
18
  const pkg = JSON.parse(fs.readFileSync(new URL("./package.json", import.meta.url), "utf8"));
@@ -453,7 +456,145 @@ async function install() {
453
456
  await setupPermissions();
454
457
  }
455
458
 
456
- const run = UNINSTALL ? uninstall : (MIGRATE ? migrate : install);
459
+ // =====================================================================
460
+ // status — read-only inspection of a project's .agents/ workflow state
461
+ // =====================================================================
462
+
463
+ // Lists *.md files (and *.draft.md) in a directory. Returns [] if missing
464
+ // or unreadable. Sorted alphabetically for stable output.
465
+ function listMarkdownFiles(dir) {
466
+ if (!fs.existsSync(dir)) return [];
467
+ try {
468
+ return fs.readdirSync(dir)
469
+ .filter((f) => f.endsWith(".md") && !f.startsWith("."))
470
+ .sort();
471
+ } catch {
472
+ return [];
473
+ }
474
+ }
475
+
476
+ // Best-effort git inspection — silently degrades when git is unavailable
477
+ // or the cwd is not inside a repo. The status command must never fail
478
+ // because of git.
479
+ function readGitState(cwd) {
480
+ const exec = (cmd) => {
481
+ try {
482
+ return execSync(cmd, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
483
+ } catch {
484
+ return null;
485
+ }
486
+ };
487
+ const insideRepo = exec("git rev-parse --is-inside-work-tree");
488
+ if (insideRepo !== "true") return { in_repo: false };
489
+ const branch = exec("git rev-parse --abbrev-ref HEAD");
490
+ const statusShort = exec("git status --short");
491
+ const uncommitted = statusShort ? statusShort.split("\n").filter(Boolean).length : 0;
492
+ return {
493
+ in_repo: true,
494
+ branch: branch || "(detached)",
495
+ uncommitted,
496
+ };
497
+ }
498
+
499
+ function readWorkflowState(cwd) {
500
+ const agentsDir = path.join(cwd, ".agents");
501
+ const present = fs.existsSync(agentsDir);
502
+
503
+ const plansDir = path.join(agentsDir, "plans");
504
+ const allPlanFiles = listMarkdownFiles(plansDir);
505
+ const draft = allPlanFiles.filter((f) => f.endsWith(".draft.md"));
506
+ const active = allPlanFiles.filter((f) => !f.endsWith(".draft.md"));
507
+
508
+ return {
509
+ agents_dir_present: present,
510
+ plans: {
511
+ draft,
512
+ active,
513
+ done: listMarkdownFiles(path.join(plansDir, "done")),
514
+ backlog: listMarkdownFiles(path.join(plansDir, "backlog")),
515
+ },
516
+ specs: listMarkdownFiles(path.join(agentsDir, "specs")),
517
+ code_reviews: listMarkdownFiles(path.join(agentsDir, "code-reviews")),
518
+ execution_reports: listMarkdownFiles(path.join(agentsDir, "execution-reports")),
519
+ system_reviews: listMarkdownFiles(path.join(agentsDir, "system-reviews")),
520
+ rca: listMarkdownFiles(path.join(agentsDir, "rca")),
521
+ audits: listMarkdownFiles(path.join(agentsDir, "audits")),
522
+ };
523
+ }
524
+
525
+ function suggestNext(state) {
526
+ if (!state.agents_dir_present) {
527
+ return "No .agents/ found — run /hopla:init-project to scaffold the workflow.";
528
+ }
529
+ if (state.plans.draft.length > 0) {
530
+ return `Plan in draft (${state.plans.draft[0]}) — run /hopla:review-plan or finalize it.`;
531
+ }
532
+ if (state.plans.active.length > 0) {
533
+ const plan = state.plans.active[0];
534
+ const baseName = plan.replace(/\.md$/, "");
535
+ const hasReport = state.execution_reports.some((r) => r.includes(baseName));
536
+ const hasReview = state.code_reviews.some((r) => r.includes(baseName));
537
+ if (!hasReview) return `Active plan (${plan}) — execute it or run code-review skill on changes.`;
538
+ if (!hasReport) return `Active plan (${plan}) reviewed — run execution-report skill.`;
539
+ return `Active plan (${plan}) reviewed and reported — consider /hopla:archive or /hopla:system-review.`;
540
+ }
541
+ if (state.code_reviews.length > 0) {
542
+ return `Pending code reviews — run /hopla:code-review-fix on them.`;
543
+ }
544
+ return "Workflow clean — start with /hopla:plan-feature.";
545
+ }
546
+
547
+ function status() {
548
+ const cwd = process.cwd();
549
+ const git = readGitState(cwd);
550
+ const workflow = readWorkflowState(cwd);
551
+ const next = suggestNext(workflow);
552
+
553
+ if (JSON_OUT) {
554
+ process.stdout.write(JSON.stringify({ cwd, git, ...workflow, next }, null, 2) + "\n");
555
+ return;
556
+ }
557
+
558
+ log(`\n${BOLD}@hopla/claude-setup${RESET} — status (${cwd})\n`);
559
+
560
+ if (git.in_repo) {
561
+ log(`${CYAN}Git:${RESET}`);
562
+ log(` Branch: ${git.branch}`);
563
+ log(` Uncommitted: ${git.uncommitted} ${git.uncommitted === 1 ? "file" : "files"}`);
564
+ log("");
565
+ } else {
566
+ log(`${YELLOW}Not inside a git repository.${RESET}\n`);
567
+ }
568
+
569
+ if (!workflow.agents_dir_present) {
570
+ log(`${YELLOW}No .agents/ directory found.${RESET}`);
571
+ log(`Run ${CYAN}/hopla:init-project${RESET} to scaffold it.\n`);
572
+ log(`${BOLD}Suggested next:${RESET} ${next}\n`);
573
+ return;
574
+ }
575
+
576
+ log(`${CYAN}Plans:${RESET}`);
577
+ log(` Draft (${workflow.plans.draft.length}): ${workflow.plans.draft.join(", ") || "—"}`);
578
+ log(` Active (${workflow.plans.active.length}): ${workflow.plans.active.join(", ") || "—"}`);
579
+ log(` Done (${workflow.plans.done.length}): ${workflow.plans.done.join(", ") || "—"}`);
580
+ log(` Backlog (${workflow.plans.backlog.length}): ${workflow.plans.backlog.join(", ") || "—"}`);
581
+ log("");
582
+
583
+ log(`${CYAN}Other artifacts:${RESET}`);
584
+ log(` Specs: ${workflow.specs.length}`);
585
+ log(` Code reviews: ${workflow.code_reviews.length}`);
586
+ log(` Execution reports: ${workflow.execution_reports.length}`);
587
+ log(` System reviews: ${workflow.system_reviews.length}`);
588
+ log(` RCAs: ${workflow.rca.length}`);
589
+ log(` Audits: ${workflow.audits.length}`);
590
+ log("");
591
+
592
+ log(`${BOLD}Suggested next:${RESET} ${next}\n`);
593
+ }
594
+
595
+ const run = STATUS
596
+ ? async () => status()
597
+ : (UNINSTALL ? uninstall : (MIGRATE ? migrate : install));
457
598
  run().catch((err) => {
458
599
  console.error("Failed:", err.message);
459
600
  process.exit(1);
@@ -0,0 +1,137 @@
1
+ ---
2
+ description: Archive a completed plan — fold its delta-specs into canonical specs and move artifacts to archive locations
3
+ argument-hint: "<plan-file-path>"
4
+ ---
5
+
6
+ > 🌐 **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
7
+
8
+ Close the lifecycle of a completed plan: fold its proposed requirement changes into the canonical specs, move the plan and design files to their archive locations, and leave the project in a clean post-feature state.
9
+
10
+ > Use this command **after** `/hopla:execute` has finished, code-review and execution-report skills have run, and changes are committed (or staged for the merge commit). The command does not write code — it only updates docs and moves files.
11
+
12
+ ## Step 0: Locate Inputs
13
+
14
+ The first argument `$1` should be the path to the completed plan (e.g. `.agents/plans/add-auth.md`). If the user did not pass a path:
15
+
16
+ 1. Run `node ~/.claude/plugins/marketplaces/hopla-marketplace/cli.js status` — or `claude-setup status` if installed via npm — to list active plans.
17
+ 2. Ask the user which one to archive.
18
+
19
+ Derive the **feature slug** from the filename (e.g. `add-auth.md` → `add-auth`).
20
+
21
+ Then look for related artifacts:
22
+
23
+ | Artifact | Expected path |
24
+ |---|---|
25
+ | Plan | `$1` (e.g. `.agents/plans/add-auth.md`) |
26
+ | Design spec | `.agents/specs/<slug>.md` or `.agents/specs/YYYY-MM-DD-<slug>.md` (latest match) |
27
+ | Code review | `.agents/code-reviews/<slug>.md` (ephemeral — do NOT preserve) |
28
+ | Execution report | `.agents/execution-reports/<slug>.md` (preserve) |
29
+ | System review | `.agents/system-reviews/<slug>-review.md` (preserve) |
30
+
31
+ If the design spec is missing, that's OK — many features start from `/hopla:plan-feature` directly without a brainstorm step. Skip the spec-merge phase.
32
+
33
+ ## Step 1: Read the Spec's Requirements Delta (if any)
34
+
35
+ If a design spec exists at `.agents/specs/<slug>.md`, read it and look for a `## Requirements Delta` section with subsections:
36
+
37
+ ```markdown
38
+ ## Requirements Delta
39
+
40
+ ### ADDED Requirements
41
+ - REQ-AUTH-002: 2FA enrollment
42
+ - Scenario: enabling 2FA — Given the user is authenticated, When they enable 2FA, Then ...
43
+
44
+ ### MODIFIED Requirements
45
+ - REQ-AUTH-001: User login (replaces previous version)
46
+ - Now includes 2FA challenge step when the account has 2FA enabled.
47
+
48
+ ### REMOVED Requirements
49
+ - REQ-AUTH-003: SMS-only fallback (deprecated)
50
+ ```
51
+
52
+ If no `## Requirements Delta` section exists, the spec is informational only — skip to Step 4 (archive moves).
53
+
54
+ ## Step 2: Locate Canonical Specs
55
+
56
+ Canonical specs live at `.agents/specs/canonical/<domain>.md` (one file per domain — e.g. `auth.md`, `payments.md`, `ui.md`). They represent the **current behavior of the system**.
57
+
58
+ For each ADDED / MODIFIED / REMOVED requirement, determine which canonical file it belongs to. The domain is usually inferable from the requirement ID prefix (`REQ-AUTH-*` → `auth.md`) or from the project's directory structure.
59
+
60
+ If `.agents/specs/canonical/` does not exist:
61
+ - Ask the user: "No canonical specs directory found. Should I create `.agents/specs/canonical/` and start it with the requirements from this change?"
62
+ - If yes, create `.agents/specs/canonical/<domain>.md` for each domain touched and treat ALL requirements from this change as initial content (no merge needed — bootstrap mode).
63
+
64
+ ## Step 3: Propose the Merge Diff (human approval required)
65
+
66
+ For each affected canonical file, build the proposed new content **in memory**:
67
+
68
+ - For each entry under `### ADDED Requirements` → append the requirement (with its scenarios) to the canonical file under `## Requirements`.
69
+ - For each entry under `### MODIFIED Requirements` → find the requirement by ID in the canonical file and **replace** its body with the new version. If the ID is not found, treat as ADDED and warn the user.
70
+ - For each entry under `### REMOVED Requirements` → find the requirement by ID and **delete** its block (heading + body until the next `### ` heading or end of section).
71
+
72
+ Show the user a summary:
73
+
74
+ ```
75
+ ## Archive plan: <slug>
76
+
77
+ Canonical specs to update:
78
+ .agents/specs/canonical/auth.md
79
+ + ADDED: REQ-AUTH-002 (2FA enrollment)
80
+ ~ MODIFIED: REQ-AUTH-001 (User login — now requires 2FA step)
81
+ - REMOVED: REQ-AUTH-003 (SMS-only fallback)
82
+
83
+ Files to move:
84
+ .agents/plans/<slug>.md → .agents/plans/done/<slug>.md
85
+ .agents/specs/<slug>.md → .agents/specs/archived/<slug>.md
86
+ .agents/code-reviews/<slug>.md → DELETE (ephemeral)
87
+
88
+ Files to keep in place:
89
+ .agents/execution-reports/<slug>.md
90
+ .agents/system-reviews/<slug>-review.md
91
+ ```
92
+
93
+ Then ask:
94
+ > "Apply these changes? (yes / show diff / cancel)"
95
+
96
+ - **show diff:** print a unified diff of each canonical file (before vs after) so the user can review the exact merge before approval.
97
+ - **cancel:** abort with no changes.
98
+ - **yes:** proceed to Step 4.
99
+
100
+ ## Step 4: Apply the Changes
101
+
102
+ Only after explicit `yes`:
103
+
104
+ 1. Write each updated canonical spec file via the Edit tool. Never overwrite blindly — always anchor on the requirement ID heading.
105
+ 2. Move (or copy + delete) the plan: `.agents/plans/<slug>.md` → `.agents/plans/done/<slug>.md`. If `.agents/plans/done/` does not exist, create it.
106
+ 3. If a design spec exists, move `.agents/specs/<slug>.md` → `.agents/specs/archived/<slug>.md`. Create `archived/` if missing.
107
+ 4. Delete the ephemeral code review at `.agents/code-reviews/<slug>.md` (if it exists). Per project policy, code reviews are working state and not committed.
108
+ 5. Leave `execution-reports/` and `system-reviews/` untouched — they are part of the cross-session learning loop.
109
+
110
+ ## Step 5: Confirm and Suggest Next
111
+
112
+ Print a final summary:
113
+
114
+ ```
115
+ ✅ Archived <slug>
116
+
117
+ Canonical specs updated:
118
+ - .agents/specs/canonical/auth.md (3 changes)
119
+
120
+ Files moved:
121
+ - plans/<slug>.md → plans/done/<slug>.md
122
+ - specs/<slug>.md → specs/archived/<slug>.md
123
+
124
+ Files removed:
125
+ - code-reviews/<slug>.md (ephemeral)
126
+ ```
127
+
128
+ Suggest:
129
+ > "Archive complete. The canonical specs now reflect this change. Consider running the `git` skill (say 'commit') to capture the merged specs, and `/hopla:system-review` if you want to mine this implementation for process improvements."
130
+
131
+ ## Notes & Edge Cases
132
+
133
+ - **No spec, no Requirements Delta:** Step 4 still runs (file moves) but no canonical specs are updated. This is the common case for tactical fixes that do not change documented requirements.
134
+ - **Canonical bootstrap:** if `.agents/specs/canonical/` is empty, this command may be the first to populate it. Use the change's specs as initial content (treat all ADDED entries as initial requirements, ignore MODIFIED/REMOVED — there is nothing to modify).
135
+ - **Conflicting modifications:** if the same REQ-* ID is modified by two parallel plans, the later archive wins. Surface this in the diff with a `⚠ conflict` marker so the user can reconcile manually before approving.
136
+ - **Reverting an archive:** this command is one-way. To revert, restore from git history (`git restore`).
137
+ - **Do not auto-commit:** per global rules, never run `git commit` or `git push` from this command. After archiving, suggest the `git` skill.
@@ -143,7 +143,7 @@ If the user requests changes that are NOT in the plan during execution:
143
143
 
144
144
  After all tasks are complete, run **Levels 1–7** from `commands/guides/validation-pyramid.md` (same repo). Do not skip levels. Do not proceed if a level fails.
145
145
 
146
- Use the exact commands from the plan's **Validation Checklist**. If not specified, read `CLAUDE.md` "Development Commands" to find the correct commands.
146
+ Use the exact commands from the plan's **Validation Checklist**. If not specified, read `AGENTS.md` (or `CLAUDE.md` as fallback) "Development Commands" to find the correct commands.
147
147
 
148
148
  Level 5 triggers the `code-review` skill (not a slash command). Level 6 is the file-drift check specific to plan execution. Level 7 surfaces items for human verification.
149
149
 
@@ -51,7 +51,7 @@ logger.info("order_created", {
51
51
  - Types serve as contracts that AI can read and follow
52
52
 
53
53
  ### 5. Comprehensive Validation Commands
54
- Include in CLAUDE.md:
54
+ Include in AGENTS.md (or CLAUDE.md for legacy projects):
55
55
  ```markdown
56
56
  ## Development Commands
57
57
  - `npm run lint` — ESLint check
@@ -6,7 +6,7 @@ Reference this guide when planning features that involve external tools or servi
6
6
  ## MCP in the PIV Loop
7
7
 
8
8
  ### During Planning (`/hopla:plan-feature`)
9
- - Check what MCP servers are configured (listed in CLAUDE.md under "MCP Servers")
9
+ - Check what MCP servers are configured (listed in AGENTS.md or CLAUDE.md under "MCP Servers")
10
10
  - For each external integration point, specify which MCP tool to use
11
11
  - Example: "Step 3: Use Playwright MCP to verify the component renders correctly"
12
12
 
@@ -28,5 +28,5 @@ Reference this guide when planning features that involve external tools or servi
28
28
 
29
29
  ## Adding MCP to Your Project
30
30
  1. Configure MCP servers in `.claude/settings.json` or `.claude/settings.local.json`
31
- 2. List them in your project's CLAUDE.md under the "MCP Servers" section
31
+ 2. List them in your project's AGENTS.md (or CLAUDE.md) under the "MCP Servers" section
32
32
  3. Pre-approve permissions in settings to avoid repeated prompts
@@ -59,7 +59,7 @@ jobs:
59
59
 
60
60
  ## Prerequisites
61
61
  - HOPLA commands installed in the repo (.claude/commands/)
62
- - CLAUDE.md configured for the project
62
+ - AGENTS.md (or CLAUDE.md) configured for the project
63
63
  - GitHub Actions enabled
64
64
  - Claude Code API key in GitHub Secrets
65
65
 
@@ -4,7 +4,7 @@ Shared reference for the full validation sequence. Callers (`commands/execute.md
4
4
 
5
5
  Run levels **in order**. Do not skip a level. Do not proceed if a level fails — fix it first.
6
6
 
7
- Commands below are generic examples; use the exact commands from the project's `CLAUDE.md` "Development Commands" section or the plan's checklist.
7
+ Commands below are generic examples; use the exact commands from the project's `AGENTS.md` (or `CLAUDE.md` as fallback) "Development Commands" section or the plan's checklist.
8
8
 
9
9
  ## Level 1 — Lint & Format
10
10
 
@@ -1,22 +1,24 @@
1
1
  ---
2
- description: Initialize a new project with a CLAUDE.md and .agents/ structure
2
+ description: Initialize a new project with AGENTS.md (+ CLAUDE.md alias) and .agents/ structure
3
3
  ---
4
4
 
5
5
  > **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
6
6
 
7
- Set up the Layer 1 planning foundation for this project: a project-specific `CLAUDE.md` with rules and architecture decisions, plus the `.agents/` directory structure.
7
+ Set up the Layer 1 planning foundation for this project: a project-specific `AGENTS.md` with rules and architecture decisions (the canonical, tool-agnostic source of truth), a thin `CLAUDE.md` alias so Claude Code auto-loads the rules, plus the `.agents/` directory structure.
8
8
 
9
- > Layer 1 = Global Rules (~/.claude/CLAUDE.md) + Project Rules (CLAUDE.md) + PRD
9
+ > Layer 1 = Global Rules (~/.claude/CLAUDE.md) + Project Rules (AGENTS.md, with CLAUDE.md alias) + PRD
10
+
11
+ > **Why AGENTS.md as the canonical file:** AGENTS.md is the tool-agnostic convention adopted by most AI coding assistants (Cursor, Copilot, Continue, Codex, etc.). Keeping a thin CLAUDE.md alias preserves Claude Code's auto-discovery without duplicating content. If the project already has an AGENTS.md or CLAUDE.md, treat that as the canonical file and only create the missing alias.
10
12
 
11
13
  ## Step 1: Read Existing Context
12
14
 
13
15
  Before asking anything, check what already exists:
14
- - Any existing `CLAUDE.md` at project root
16
+ - Any existing `AGENTS.md` or `CLAUDE.md` at project root (AGENTS.md takes precedence as canonical; CLAUDE.md without AGENTS.md is treated as canonical until migrated)
15
17
  - `README.md` — extract stack and project overview
16
18
  - `package.json`, `pyproject.toml`, or equivalent — extract stack and scripts
17
19
  - Entry point files (`main.py`, `src/main.ts`, `app.py`, etc.)
18
20
 
19
- If a `CLAUDE.md` already exists at the project root, tell the user and ask if they want to update it or start fresh.
21
+ If an `AGENTS.md` or `CLAUDE.md` already exists at the project root, tell the user and ask if they want to update it or start fresh. If only `CLAUDE.md` exists (legacy layout), offer to migrate: rename to `AGENTS.md` and create a thin `CLAUDE.md` alias.
20
22
 
21
23
  ## Step 2: Understand the Product
22
24
 
@@ -166,11 +168,23 @@ Once the stack is confirmed, ask only what's NOT already known from the PRD or c
166
168
  2. **Project description** — skip if already in PRD
167
169
  3. **Reference Guides** (optional) — Are there specific task types that need step-by-step guidance? (e.g. "When adding a page", "When creating an API route"). If none, skip — guides can always be added later.
168
170
 
169
- ## Step 5: Generate CLAUDE.md
171
+ ## Step 5: Generate AGENTS.md (+ CLAUDE.md alias)
172
+
173
+ Save the full project rules to `AGENTS.md` at the project root (canonical, tool-agnostic source of truth). Then create a thin `CLAUDE.md` alias so Claude Code auto-discovers the rules without duplicating content.
174
+
175
+ **`CLAUDE.md` alias contents (always identical, regardless of stack):**
176
+
177
+ ```markdown
178
+ # [Project Name] — Project Rules
179
+
180
+ The canonical project rules live in [`AGENTS.md`](./AGENTS.md). This file is a thin alias kept for Claude Code's auto-discovery.
181
+
182
+ @AGENTS.md
183
+ ```
170
184
 
171
- Save to `CLAUDE.md` at the project root. Use this structure:
185
+ > The `@AGENTS.md` directive instructs Claude Code to inline the AGENTS.md contents into context. Other AI assistants read AGENTS.md directly.
172
186
 
173
- **For default stack projects**, use these pre-filled values:
187
+ **`AGENTS.md` contents — for default stack projects**, use these pre-filled values:
174
188
 
175
189
  ```markdown
176
190
  # [Project Name] — Development Rules
@@ -315,7 +329,9 @@ Read: `.agents/guides/[guide-name].md`
315
329
  This guide covers: [bullet list]
316
330
  ```
317
331
 
318
- **For custom stack projects**, fill in the values collected during Step 2.2 following the same structure.
332
+ **For custom stack projects**, fill in the values collected during Step 2.2 / Step 3.1 following the same structure.
333
+
334
+ > Both default and custom flows write to `AGENTS.md`. The `CLAUDE.md` alias is the same in both cases.
319
335
 
320
336
  ## Step 5.5: Generate Reference Guides
321
337
 
@@ -407,7 +423,7 @@ After implementing, verify:
407
423
 
408
424
  **Important:** Guides must contain concrete, project-specific information — not generic advice. If the user's answers don't have enough detail for a section, ask a follow-up before writing the guide.
409
425
 
410
- Also update the `CLAUDE.md` Section 7 (Task-Specific Reference Guides) to reference each guide created:
426
+ Also update the `AGENTS.md` Section 7 (Task-Specific Reference Guides) to reference each guide created:
411
427
 
412
428
  ```markdown
413
429
  ## 7. Task-Specific Reference Guides
@@ -428,9 +444,11 @@ Create the following directories (with `.gitkeep` where needed):
428
444
  ```
429
445
  .agents/
430
446
  ├── plans/ <- /hopla:plan-feature saves here (commit)
431
- │ ├── done/ <- /hopla:system-review archives completed plans here (commit)
447
+ │ ├── done/ <- /hopla:archive moves completed plans here (commit)
432
448
  │ └── backlog/ <- /hopla:execute Scope Guard defers ideas here (commit)
433
449
  ├── specs/ <- brainstorm skill saves design docs here (commit)
450
+ │ ├── canonical/ <- canonical "current behavior" specs by domain (commit; populated incrementally by /hopla:archive)
451
+ │ └── archived/ <- /hopla:archive moves completed design specs here (commit)
434
452
  ├── guides/ <- on-demand reference guides (commit)
435
453
  ├── rca/ <- /hopla:rca saves root cause analysis docs here (commit)
436
454
  ├── execution-reports/ <- the `execution-report` skill saves here (commit — needed for cross-session learning)
@@ -439,6 +457,8 @@ Create the following directories (with `.gitkeep` where needed):
439
457
  └── code-reviews/ <- the `code-review` skill saves here (do NOT commit — ephemeral, consumed by code-review-fix)
440
458
  ```
441
459
 
460
+ > **`specs/canonical/` is opt-in.** It is populated only as `/hopla:archive` is used. Until the first archive runs, the directory simply stays empty. Projects that prefer to keep all behavior knowledge in code + AGENTS.md can ignore it.
461
+
442
462
  **Policy — `audits/` vs `code-reviews/`:**
443
463
 
444
464
  - `code-reviews/` is **ephemeral working state**. Every run overwrites/adds files; `code-review-fix` consumes them and they become stale fast. Never commit.
@@ -475,13 +495,14 @@ If yes, create `.claude/commands/validate.md`.
475
495
 
476
496
  ## Step 8: Confirm and Save
477
497
 
478
- Show the draft `CLAUDE.md` to the user and ask:
498
+ Show the draft `AGENTS.md` to the user and ask:
479
499
  > "Does this accurately reflect the project's rules? Any corrections before I save it?"
480
500
 
481
501
  Once confirmed:
482
- 1. Save `CLAUDE.md` to the project root
483
- 2. Create `.agents/` directory structure
484
- 3. Update `.gitignore`
485
- 4. If no PRD exists yet, tell the user: "Project initialized. Run `/hopla:create-prd` next to define the product scope, or `/hopla:plan-feature` to start planning a feature."
502
+ 1. Save `AGENTS.md` to the project root
503
+ 2. Create `CLAUDE.md` at the project root with the standard alias content (see Step 5) — skip if a meaningful `CLAUDE.md` already exists; in that case ask the user whether to overwrite with the alias stub or leave it untouched
504
+ 3. Create `.agents/` directory structure
505
+ 4. Update `.gitignore`
506
+ 5. If no PRD exists yet, tell the user: "Project initialized. Run `/hopla:create-prd` next to define the product scope, or `/hopla:plan-feature` to start planning a feature."
486
507
  If a PRD already exists, tell the user: "Project initialized. Run `/hopla:plan-feature` to start planning the first feature."
487
- 5. Suggest running the `git` skill (say "commit") to save everything
508
+ 6. Suggest running the `git` skill (say "commit") to save everything