get-tbd 0.1.29 → 0.2.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 (93) hide show
  1. package/README.md +5 -1
  2. package/dist/bin.mjs +3241 -2326
  3. package/dist/bin.mjs.map +1 -1
  4. package/dist/cli.mjs +1503 -791
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/{config-B38rbI9u.mjs → config-BJz1m9eN.mjs} +183 -39
  7. package/dist/config-BJz1m9eN.mjs.map +1 -0
  8. package/dist/{config-C0ITTrtc.mjs → config-DlCUMyCG.mjs} +1 -1
  9. package/dist/docs/README.md +5 -1
  10. package/dist/docs/SKILL.md +0 -1
  11. package/dist/docs/guidelines/backward-compatibility-rules.md +4 -0
  12. package/dist/docs/guidelines/bun-monorepo-patterns.md +20 -4
  13. package/dist/docs/guidelines/cli-agent-skill-patterns.md +354 -37
  14. package/dist/docs/guidelines/commit-conventions.md +4 -0
  15. package/dist/docs/guidelines/common-doc-guidelines.md +234 -0
  16. package/dist/docs/guidelines/convex-limits-best-practices.md +4 -0
  17. package/dist/docs/guidelines/convex-rules.md +4 -0
  18. package/dist/docs/guidelines/electron-app-development-patterns.md +4 -0
  19. package/dist/docs/guidelines/error-handling-rules.md +4 -0
  20. package/dist/docs/guidelines/general-coding-rules.md +4 -0
  21. package/dist/docs/guidelines/general-comment-rules.md +4 -0
  22. package/dist/docs/guidelines/general-eng-assistant-rules.md +4 -0
  23. package/dist/docs/guidelines/general-tdd-guidelines.md +4 -0
  24. package/dist/docs/guidelines/general-testing-rules.md +4 -0
  25. package/dist/docs/guidelines/golden-testing-guidelines.md +4 -0
  26. package/dist/docs/guidelines/pnpm-monorepo-patterns.md +27 -6
  27. package/dist/docs/guidelines/python-cli-patterns.md +4 -0
  28. package/dist/docs/guidelines/python-modern-guidelines.md +30 -0
  29. package/dist/docs/guidelines/python-rules.md +4 -0
  30. package/dist/docs/guidelines/release-notes-guidelines.md +4 -0
  31. package/dist/docs/guidelines/supply-chain-hardening.md +11 -7
  32. package/dist/docs/guidelines/tbd-sync-troubleshooting.md +10 -4
  33. package/dist/docs/guidelines/typescript-cli-tool-rules.md +27 -24
  34. package/dist/docs/guidelines/typescript-code-coverage.md +11 -7
  35. package/dist/docs/guidelines/typescript-rules.md +10 -6
  36. package/dist/docs/guidelines/typescript-sorting-patterns.md +4 -0
  37. package/dist/docs/guidelines/typescript-yaml-handling-rules.md +7 -3
  38. package/dist/docs/install/ensure-gh-cli.sh +59 -24
  39. package/dist/docs/shortcuts/standard/agent-handoff.md +4 -0
  40. package/dist/docs/shortcuts/standard/checkout-third-party-repo.md +4 -0
  41. package/dist/docs/shortcuts/standard/code-cleanup-all.md +4 -0
  42. package/dist/docs/shortcuts/standard/code-cleanup-docstrings.md +4 -0
  43. package/dist/docs/shortcuts/standard/code-cleanup-tests.md +4 -0
  44. package/dist/docs/shortcuts/standard/code-review-and-commit.md +4 -0
  45. package/dist/docs/shortcuts/standard/coding-spike.md +4 -0
  46. package/dist/docs/shortcuts/standard/create-or-update-pr-simple.md +4 -0
  47. package/dist/docs/shortcuts/standard/create-or-update-pr-with-validation-plan.md +4 -0
  48. package/dist/docs/shortcuts/standard/implement-beads.md +4 -0
  49. package/dist/docs/shortcuts/standard/merge-upstream.md +4 -0
  50. package/dist/docs/shortcuts/standard/new-architecture-doc.md +4 -0
  51. package/dist/docs/shortcuts/standard/new-guideline.md +4 -0
  52. package/dist/docs/shortcuts/standard/new-plan-spec.md +4 -0
  53. package/dist/docs/shortcuts/standard/new-qa-playbook.md +4 -0
  54. package/dist/docs/shortcuts/standard/new-research-brief.md +4 -0
  55. package/dist/docs/shortcuts/standard/new-shortcut.md +4 -0
  56. package/dist/docs/shortcuts/standard/new-validation-plan.md +4 -0
  57. package/dist/docs/shortcuts/standard/plan-implementation-with-beads.md +4 -0
  58. package/dist/docs/shortcuts/standard/precommit-process.md +4 -0
  59. package/dist/docs/shortcuts/standard/review-code-python.md +4 -0
  60. package/dist/docs/shortcuts/standard/review-code-typescript.md +4 -0
  61. package/dist/docs/shortcuts/standard/review-code.md +4 -0
  62. package/dist/docs/shortcuts/standard/review-github-pr.md +4 -0
  63. package/dist/docs/shortcuts/standard/revise-all-architecture-docs.md +4 -0
  64. package/dist/docs/shortcuts/standard/revise-architecture-doc.md +4 -0
  65. package/dist/docs/shortcuts/standard/setup-github-cli.md +4 -0
  66. package/dist/docs/shortcuts/standard/sync-failure-recovery.md +4 -0
  67. package/dist/docs/shortcuts/standard/update-specs-status.md +4 -0
  68. package/dist/docs/shortcuts/standard/welcome-user.md +4 -0
  69. package/dist/docs/tbd-closing.md +4 -0
  70. package/dist/docs/tbd-design.md +109 -68
  71. package/dist/docs/tbd-docs.md +20 -13
  72. package/dist/docs/tbd-prime.md +4 -0
  73. package/dist/docs/templates/architecture-doc.md +4 -0
  74. package/dist/docs/templates/plan-spec.md +4 -0
  75. package/dist/docs/templates/qa-playbook.md +4 -0
  76. package/dist/docs/templates/research-brief.md +4 -0
  77. package/dist/{id-mapping-Ctfl_nc1.mjs → id-mapping-CFoPVinz.mjs} +1 -1
  78. package/dist/{id-mapping-CqrrLgeX.mjs → id-mapping-CtfTfGIh.mjs} +146 -122
  79. package/dist/id-mapping-CtfTfGIh.mjs.map +1 -0
  80. package/dist/index.d.mts +53 -1
  81. package/dist/index.mjs +3 -3
  82. package/dist/{schemas-C8mOQykE.mjs → schemas-f0EcuAVu.mjs} +40 -3
  83. package/dist/schemas-f0EcuAVu.mjs.map +1 -0
  84. package/dist/{src-CJyVkC3V.mjs → src-rIE4xSVs.mjs} +3 -3
  85. package/dist/src-rIE4xSVs.mjs.map +1 -0
  86. package/dist/tbd +3241 -2326
  87. package/package.json +1 -1
  88. package/dist/config-B38rbI9u.mjs.map +0 -1
  89. package/dist/docs/guidelines/general-style-rules.md +0 -38
  90. package/dist/docs/guidelines/writing-style-guidelines.md +0 -42
  91. package/dist/id-mapping-CqrrLgeX.mjs.map +0 -1
  92. package/dist/schemas-C8mOQykE.mjs.map +0 -1
  93. package/dist/src-CJyVkC3V.mjs.map +0 -1
@@ -104,13 +104,16 @@ So:
104
104
 
105
105
  - **Prompt/instructions only** → ship a `SKILL.md`. (§3, §4)
106
106
  - **Project-wide conventions** (build/test/style) → add an `AGENTS.md`. (§2)
107
- - **You have a CLI** → `SKILL.md` + agent-friendly `--json` CLI. (§0.2, §6)
107
+ - **You have a CLI** → `SKILL.md` and an agent-friendly `--json` CLI. (§0.2, §6)
108
108
  - **Many subcommands / a knowledge library** → CLI-as-skill meta-pattern.
109
109
  (§6)
110
110
  - **A service with no CLI, or you need OAuth / multi-tenant / audit** → MCP server.
111
111
  (§7)
112
- - **Maximum reach across many agents** → layer them: AGENTS.md + SKILL.md + CLI + MCP.
112
+ - **Maximum reach across many agents** → layer them: AGENTS.md, SKILL.md, CLI, and MCP.
113
113
  (§1)
114
+ - **Self-installs into agents & ships evolving skills?** → that is the advanced Tier 2
115
+ pattern (self-upgrade and format versioning); most tools are Tier 1: a pure skill run
116
+ via a **pinned** `npx`/`uvx`. (§6.0)
114
117
 
115
118
  Everything below is reference material.
116
119
  You do not need most of it for most tools.
@@ -133,7 +136,7 @@ or capability.
133
136
  | 5. Per-agent polish | `.cursor/rules/*.mdc`, plugin packaging, ACP, etc. | Glob-scoped activation, enterprise distribution, editor discovery | Per-agent |
134
137
 
135
138
  **Recommended default for a tool author who wants broad reach**: ship an `AGENTS.md`
136
- snippet (universal baseline) + a `SKILL.md` (portable capability) + an agent-friendly
139
+ snippet (universal baseline), a `SKILL.md` (portable capability), and an agent-friendly
137
140
  CLI. Add an MCP server only when a CLI can’t serve the need.
138
141
  Add agent-specific files last, and only where they buy something.
139
142
 
@@ -172,14 +175,37 @@ Canonical spec: [agents.md](https://agents.md).
172
175
  context).
173
176
  Put deep, on-demand material in skills or files the agent can open when needed.
174
177
  `AGENTS.override.md` lets a developer override the committed file locally without
175
- editing it.
178
+ editing it. If a CLI writes a managed `AGENTS.md` block, keep that block as a compact
179
+ bootstrap: name the tool, state the always-on operating rule, and point to commands such
180
+ as `mycli prime`, `mycli skill`, `mycli shortcut --list`, and `mycli guidelines --list`.
181
+ Do not paste the full skill body or generated resource directories into `AGENTS.md`;
182
+ prefer less than 80-150 lines, and shorter is better.
183
+ If `AGENTS.md` already exists without your markers, preserve the file and append a
184
+ compact marked block instead of overwriting user content.
185
+ Version the managed block by carrying the format on the **begin marker line itself** (an
186
+ `fNN` string, like a config-format version) so future setup runs can upgrade old
187
+ generated content without touching user-authored text:
188
+
189
+ ```markdown
190
+ <!-- BEGIN MYCLI INTEGRATION format=f02 surface=agents-md -->
191
+ ## mycli
192
+
193
+ - Run `mycli prime` for current project context.
194
+ - Run `mycli skill` for complete skill instructions.
195
+
196
+ <!-- END MYCLI INTEGRATION -->
197
+ ```
198
+
199
+ Keep the begin/end marker *names* stable (`<!-- BEGIN MYCLI INTEGRATION`) — match on
200
+ that prefix so detection finds both legacy blocks (no `format=`, treated as `f01`) and
201
+ current ones. Only the `format=fNN` value changes when the block’s shape changes.
176
202
 
177
203
  * * *
178
204
 
179
205
  ## 3. The Agent Skills Standard (SKILL.md)
180
206
 
181
- **What it is**: a folder with a `SKILL.md` file (YAML frontmatter + Markdown body), plus
182
- optional supporting files.
207
+ **What it is**: a folder with a `SKILL.md` file (YAML frontmatter and a Markdown body),
208
+ plus optional supporting files.
183
209
  Created by Anthropic (Dec 2025), published under Apache 2.0 at
184
210
  [agentskills.io](https://agentskills.io).
185
211
  280,000+ public skills exist as of early 2026.
@@ -292,8 +318,8 @@ Earlier guidance cited a flat ~15K-character budget.
292
318
  - The skill listing gets a budget of **~1% of the model’s context window** by default
293
319
  (`skillListingBudgetFraction`, default `0.01`). When it overflows, the
294
320
  least-recently-invoked skills lose their descriptions first.
295
- - Per-skill listing text (`description` + `when_to_use`) is truncated at **1,536 chars**
296
- (`maxSkillDescriptionChars`).
321
+ - Per-skill listing text (`description` and `when_to_use`) is truncated at **1,536
322
+ chars** (`maxSkillDescriptionChars`).
297
323
  - `SLASH_COMMAND_TOOL_CHAR_BUDGET` overrides the fraction with a fixed character count.
298
324
  - `skillOverrides` can set any skill to `on` / `name-only` / `user-invocable-only` /
299
325
  `off` without editing the file; `/doctor` reports overflow.
@@ -343,7 +369,7 @@ you care about.
343
369
  | Agent | Project file | Skill / rules mechanism | MCP | Hooks | Best integration path |
344
370
  | --- | --- | --- | --- | --- | --- |
345
371
  | **Claude Code** | `CLAUDE.md` | Agent Skills (`SKILL.md`), `.claude/skills/`; plugins/marketplaces | Yes (stdio + Streamable HTTP) | 29 events | SKILL.md (+ plugin for distribution) |
346
- | **Codex CLI** | `AGENTS.md` | `SKILL.md` skills + plugins (skills+MCP); `~/.codex/prompts` (deprecated) | Yes (stdio + Streamable HTTP) | | AGENTS.md + skills/plugins + MCP |
372
+ | **Codex CLI** | `AGENTS.md` | `SKILL.md` skills + plugins (skills+MCP); `~/.codex/prompts` (deprecated) | Yes (stdio + Streamable HTTP) | Claude-compatible engine (`SessionStart`, `Pre/PostCompact`, `Pre/PostToolUse`, `UserPromptSubmit`, `Stop`, …) | AGENTS.md + skills/plugins + MCP |
347
373
  | **Cursor** | `.cursor/rules/*.mdc`, `AGENTS.md` | MDC rules (Always/Auto-glob/Agent-requested/Manual) | Yes | 6 events (incl. `beforeShellExecution`) | AGENTS.md + `.mdc` for glob scoping |
348
374
  | **GitHub Copilot** | `.github/copilot-instructions.md`, `AGENTS.md` | `SKILL.md` (VS Code); `.agent.md` custom agents | Yes | `preToolUse`/`postToolUse`/… | SKILL.md + MCP; enterprise-managed plugins |
349
375
  | **Gemini CLI** | `GEMINI.md` + `AGENTS.md` | Agent Skills; extensions (bundle hooks) | Yes (stdio + SSE) | ~12 events | AGENTS.md + MCP/extension |
@@ -367,11 +393,28 @@ clean endorsement of the CLI-as-skill approach: a self-documenting CLI plus a `S
367
393
  is exactly what a minimal agent wants.
368
394
 
369
395
  **Codex specifics** (it gained a real skill system in 2026): skills are `SKILL.md`
370
- folders with the same progressive disclosure, discovered from
371
- repository/user/admin/system `.agents/skills/` directories.
372
- **Plugins** are one distribution layer on top (installable units bundling skills + MCP
373
- servers 90+ ship with Codex), not the only install path a plain
374
- `.agents/skills/<name>/SKILL.md` works without packaging.
396
+ folders with the same progressive disclosure.
397
+ Verified against the Codex source (`codex-rs/core-skills/src/loader.rs`, tags
398
+ `rust-v0.130.0`…`v0.133.0`): the loader scans several **scopes** `Repo` (every
399
+ `<dir>/.agents/skills/` from the project root down to cwd), `User`
400
+ (`$HOME/.agents/skills/`), `Admin`, plus plugin roots and `$CODEX_HOME/skills`. So a
401
+ **plain repo-root `.agents/skills/<name>/SKILL.md` is read directly**, no manifest
402
+ required. (The repo path is built by joining `.agents` and `skills` at runtime, so it
403
+ does *not* appear as a contiguous `.agents/skills` literal in the binary — a
404
+ `strings`-based inspection will miss it and see only `.agents/plugins/marketplace.json`;
405
+ confirm against the source, not binary strings.)
406
+ **Plugins** are an *additional* distribution layer (installable units bundling skills
407
+ and MCP servers — 90+ ship with Codex), declared in `.agents/plugins/marketplace.json`
408
+ (also reads `.claude-plugin/marketplace.json`) — useful for *publishing a bundle*, but
409
+ not needed to make a repo-local skill load.
410
+ Codex skills may carry a richer **`agents/openai.yaml`** companion (e.g.
411
+ `interface.display_name`, icons, `dependencies.tools[]`,
412
+ `policy.allow_implicit_invocation`); map the portable
413
+ `name`/`description`/`allowed-tools` onto it only when you specifically want that Codex
414
+ polish — it’s optional.
415
+ An experimental, off-by-default **`external_migration`** feature can import `.claude/`
416
+ config (hooks/MCP/skills) into `.codex/`; don’t depend on it yet, but expect the
417
+ portable duplication to shrink if it stabilizes.
375
418
  Operational config lives in `~/.codex/config.toml` (or trusted per-project
376
419
  `.codex/config.toml`): `model`, `approval_policy`
377
420
  (`untrusted`/`on-request`/`granular`/`never`), `sandbox_mode`
@@ -388,12 +431,42 @@ sandboxed.
388
431
  This is the pattern for a richer tool: a CLI that is itself a skill, exposing many
389
432
  capabilities as subcommands while costing a single description slot.
390
433
  `tbd` is the reference implementation; **Beads/`bd`** (Steve Yegge), `tbd`’s lineage,
391
- follows the same shape (subcommands + `AGENTS.md` + `--json` + an optional MCP server).
434
+ follows the same shape (subcommands, `AGENTS.md`, `--json`, and an optional MCP server).
392
435
 
393
436
  Use this when you have many capabilities, need cross-session state, or want a curated
394
437
  knowledge library the agent pulls from.
395
438
  For a single capability, the §0 baseline is better — don’t reach for this prematurely.
396
439
 
440
+ ### 6.0 Two integration tiers — pick the lighter one
441
+
442
+ Most tools should **not** self-install.
443
+ Decide which tier you are before adding any setup machinery:
444
+
445
+ - **Tier 1 — pure skill (the default for most tools).** Ship a `SKILL.md` (optionally an
446
+ `AGENTS.md` snippet); users install it once (commit to `.agents/skills/`,
447
+ `npx skills add`, or the Claude mirror).
448
+ Invoke the tool through a **version-pinned** zero-install runner —
449
+ `npx --yes pkg@<ver>`, `uvx --from pkg@<ver>`, or `pipx run pkg==<ver>` (§6.7). No
450
+ hooks, no managed `AGENTS.md` block, no `setup` command, no format versioning.
451
+ Pinning the version here does **double duty**:
452
+ - **Supply-chain control** — an unpinned runner (`npx pkg`, `uvx --from pkg`) silently
453
+ re-resolves to the latest published version on every run and bypasses any cool-off
454
+ window. A pinned version is the artifact you actually vetted.
455
+ - **Consistency control** — every teammate and every agent runs the *same* tool
456
+ version, so skill behavior is reproducible across a team and across agents rather
457
+ than drifting as upstream publishes new releases.
458
+ - **Tier 2 — self-installing CLI (advanced; the rest of §6).** A tool that writes its
459
+ own integration files into multiple agents (`.agents/skills/`, `.claude/skills/`, a
460
+ managed `AGENTS.md` block, hooks, `.codex/` config) **and** whose skill content
461
+ evolves across releases.
462
+ Take on this complexity only for a tool with many capabilities, cross-session state,
463
+ or a curated knowledge library.
464
+ The self-upgrade and format-versioning rules in §6.6 apply **only to this tier** — a
465
+ pure skill never needs them.
466
+
467
+ If in doubt, you are Tier 1. `tbd` is a Tier-2 reference implementation; most CLIs are
468
+ not.
469
+
397
470
  ### 6.1 Two kinds of commands
398
471
 
399
472
  | Type | Purpose | Examples |
@@ -477,37 +550,192 @@ Rules: reference commands **explicitly** (`mycli command arg`, never “see the
477
550
  - **Actionable errors** that include the next command to run.
478
551
  - **Discoverable help**: an `IMPORTANT:` epilog pointing at a context-restore command
479
552
  (e.g., `mycli prime`), and a “Getting Started” one-liner.
480
- - **A `prime` command** (dashboard + status + rules) for session start and post-compact,
481
- distinct from `skill` (pure documentation).
553
+ - **A `prime` command** (dashboard, status, and rules) for session start and
554
+ post-compact, distinct from `skill` (pure documentation).
482
555
 
483
556
  ### 6.6 Distribution & multi-agent install
484
557
 
485
558
  A CLI can install itself into multiple agents from one `setup` run.
486
- tbd writes a CLI-managed `SKILL.md` to `.claude/skills/tbd/` and a **marker-bounded
487
- section** into `AGENTS.md` (which now also feeds Cursor, Codex, and Factory), preserving
488
- user content outside the markers:
559
+ Use the portable Agent Skills location as the primary project skill surface and mirror
560
+ only where a target agent requires it:
561
+
562
+ - `.agents/skills/<tool>/SKILL.md` — the portable project skill.
563
+ **Be precise about who reads this path natively vs.
564
+ who reaches it via an installer**, rather than claiming a flat “all agents read it”:
565
+ - **Scans repo-root `.agents/skills/` natively** (verified): **Codex** (source above)
566
+ and **Gemini CLI** (documents `.agents/skills/` as a workspace/user alias).
567
+ **pi** / **OpenCode** scan project Agent Skills dirs.
568
+ - **Reached via the cross-agent installer**: `npx skills add` copies the same
569
+ `SKILL.md` into `.agents/skills/` and **symlinks it into each agent’s own dir**
570
+ (Cursor, Copilot, Cline, Amp, Windsurf, …). For those agents the *installer*, not
571
+ the agent, is what binds `.agents/skills/` to their native location — so “works with
572
+ Cursor/Copilot/…” means “via skills.sh”, not “Cursor scans `.agents/skills/`
573
+ itself.”
574
+ - **Claude Code does NOT scan `.agents/`** at all — it reads only `.claude/skills/`
575
+ (next bullet), which is why the mirror is required, not optional.
576
+ - When in doubt, verify against the agent’s source/docs before asserting native
577
+ scanning.
578
+ - `.claude/skills/<tool>/SKILL.md` — Claude Code compatibility mirror (required: Claude
579
+ Code reads only this path).
580
+ - `AGENTS.md` — compact always-on project bootstrap, not a full copy of the skill.
581
+ - `.codex/hooks.json` or `.codex/config.toml` — Codex lifecycle automation, not policy
582
+ text or skill content.
583
+
584
+ tbd should write a CLI-managed `SKILL.md` to `.agents/skills/tbd/`, mirror it to
585
+ `.claude/skills/tbd/`, and maintain a **marker-bounded section** in `AGENTS.md` (which
586
+ also feeds Cursor, Codex, and Factory), preserving user content outside the markers:
489
587
 
490
588
  ```markdown
491
- <!-- BEGIN MYCLI INTEGRATION -->
492
- …CLI-generated… ← owned by the CLI; regenerated on setup
589
+ <!-- BEGIN MYCLI INTEGRATION format=f02 surface=agents-md -->
590
+ ## mycli
591
+
592
+ - Run `mycli prime` for current project context.
593
+ - Run `mycli skill` for the full reusable skill instructions.
594
+ - Run `mycli shortcut --list` and `mycli guidelines --list` for on-demand resources.
595
+
493
596
  <!-- END MYCLI INTEGRATION -->
494
597
  ```
495
598
 
599
+ **Quick recipe for a new project** (portable-first, both agents covered):
600
+
601
+ ```text
602
+ .agents/skills/<tool>/SKILL.md # canonical portable skill (Codex, Gemini, Cursor, …)
603
+ .claude/skills/<tool>/SKILL.md # identical copy — Claude Code mirror
604
+ AGENTS.md # compact marked block (see above), every agent reads it
605
+ CLAUDE.md # symlink → AGENTS.md, or a short separate file (Claude only)
606
+ scripts/agent/<tool>-session.sh # shared hook script, referenced by both agents
607
+ .codex/hooks.json # Codex hook entry → shared script (or inline [hooks])
608
+ .claude/settings.json # Claude hook entry → same shared script
609
+ ```
610
+
611
+ Copy (don’t symlink) the `SKILL.md` payload to both skill paths — symlinks behave
612
+ unevenly across Windows, sandboxes, and remote worktrees.
613
+ Claude Code does **not** auto-load `AGENTS.md` (it reads `CLAUDE.md`), so a multi-agent
614
+ project needs both.
615
+
496
616
  **File-ownership rules** — distinguish three categories:
497
617
 
498
618
  - **Project instruction files** (`AGENTS.md`, `CLAUDE.md`): *commit these*. They hold
499
619
  human-authored project norms (§2). A CLI may own a **marker-bounded section** inside
500
620
  `AGENTS.md` (regenerated on setup) while the user owns everything outside the markers.
501
- - **Fully generated install artifacts** (`.claude/skills/<tool>/SKILL.md` and the like):
502
- CLI-owned; mark them “DO NOT EDIT.” Commit them only if the project intentionally
503
- dogfoods them otherwise leave them to `setup` (and consider gitignoring).
621
+ - **Fully generated install artifacts** (`.agents/skills/<tool>/SKILL.md`,
622
+ `.claude/skills/<tool>/SKILL.md`, generated hook scripts, and the like): CLI-owned;
623
+ mark them “DO NOT EDIT.” Pick **one of two modes** and be consistent:
624
+ - **Commit and dogfood** (what `tbd` does): check the generated artifacts in, and add
625
+ a **drift test** that regenerates them and fails if they differ.
626
+ Pros: browsable on GitHub / skills.sh, the repo demonstrates its own output,
627
+ reviewers see changes.
628
+ Con: a regeneration shows up as a diff to commit.
629
+ Keep generated output deterministic and formatter-stable (below) or the drift
630
+ test/commits will churn.
631
+ - **Gitignore and regenerate** (what `metaproc` does): add `.../skills/*/SKILL.md` to
632
+ `.gitignore` and let `setup`/`--install` (re)create them on demand.
633
+ Pros: zero commit churn, no drift to guard.
634
+ Con: not browsable in the repo, and no committed artifact to diff in review.
635
+ With this mode a format-version stamp matters less (there is no committed artifact
636
+ for an older tool to clobber).
504
637
  - **Source files** in the CLI package (header, baseline, brief): the canonical inputs —
505
638
  always version-controlled.
506
639
 
507
640
  Make setup idempotent: dedupe hooks before merging, overwrite generated skills rather
508
641
  than patching them, update only the marked section of `AGENTS.md`, and clean up legacy
509
- files each run. (Generated output must also be stable under whatever formatter the repo
510
- runs — e.g. don’t emit a second YAML frontmatter block mid-document.)
642
+ files each run.
643
+
644
+ **Generated output must be deterministic.** A given input state must always produce
645
+ byte-identical output — no timestamps, no random IDs, no machine-specific paths, no
646
+ unstable ordering. This is what makes the artifact diff-stable, drift-testable, and safe
647
+ to regenerate. It must also be stable under whatever formatter the repo runs (e.g. emit
648
+ the managed block in the formatter’s canonical form — sentence-aware line wrapping,
649
+ correct quote style — so a format pass is a no-op; and don’t emit a second YAML
650
+ frontmatter block mid-document).
651
+ Because Codex and Claude Code now share a hook event schema (§8), prefer **one shared
652
+ script referenced by two thin per-agent configs**: keep the logic in a neutral location
653
+ (e.g. `scripts/agent/<tool>-session.sh`) and reference it from both
654
+ `.claude/settings.json` and the Codex `[hooks]`/`.codex/hooks.json` entry.
655
+ Do not make Codex hooks call scripts stored under `.claude/` — that couples Codex setup
656
+ to Claude setup. If a script must move out of `.claude/scripts/`, update the tbd-owned
657
+ hook commands (or leave a wrapper) so existing Claude hooks keep working.
658
+
659
+ **Upgrade existing installs deliberately (Tier 2 only).** A self-installing tool whose
660
+ skill content evolves *will* leave older generated files in users’ repos.
661
+ Treat generated integration files like config migrations:
662
+
663
+ - Version the generated surfaces with an `fNN` format code.
664
+ Prefer **one format code for all the tool’s managed surfaces** — reuse the tool’s
665
+ existing config/data-format version as the single source of truth (tbd stamps the
666
+ AGENTS.md block with the same `tbd_format`, currently `f03`) rather than maintaining a
667
+ parallel counter. Bump it when any managed surface — config schema or a generated agent
668
+ surface — changes shape.
669
+ - Stamp the format on the generated artifact itself: on the `AGENTS.md` begin-marker
670
+ line (`<!-- BEGIN … format=fNN … -->`), the skill “DO NOT EDIT” marker, script
671
+ headers, or an equivalent hook signature.
672
+ Prefer one marker line over a separate metadata comment.
673
+ - On every `setup`/`setup --auto` run, **self-upgrade in place, safely and
674
+ idempotently**: detect older formats and rewrite only the tool-owned regions (managed
675
+ `AGENTS.md` block, generated skills, tool-owned hooks, `.codex/` config), re-running
676
+ cleanly with no change when already current.
677
+ - Treat old marked `AGENTS.md` blocks with no metadata as legacy generated content and
678
+ replace only the managed region.
679
+ - Detect tool-owned hook entries by command/path/signature, replace only those entries,
680
+ and preserve unrelated user hooks.
681
+ - **Forward-compatibility guard.** When the tool finds a generated artifact whose
682
+ `integration-format` is **newer** than the running version understands, it must **stop
683
+ and tell the user to upgrade the tool** (e.g. `npm install -g get-tbd@latest`) rather
684
+ than overwrite or downgrade it.
685
+ This is what makes pinning safe for teams: a teammate on an older version fails loudly
686
+ instead of silently clobbering a newer managed block.
687
+ - Print an itemized setup summary: current, installed, upgraded, removed legacy, skipped
688
+ by config, user-owned/unmarked, and format-too-new (upgrade required).
689
+ - Test upgrades from at least the previous shipped setup layout plus partial installs,
690
+ and test that a too-new format string produces the upgrade-the-tool error.
691
+
692
+ Recommended setup flags:
693
+
694
+ | Flag | Purpose |
695
+ | --- | --- |
696
+ | `--auto` | Detect and refresh relevant project-local integrations |
697
+ | `--all` | Install every supported project-local integration surface |
698
+ | `--claude` | Install or refresh the Claude Code surface (skill mirror + hooks) |
699
+ | `--codex` | Install or refresh the Codex surface (`AGENTS.md` block + `.codex` hooks) |
700
+ | `--skip-<surface>` | Suppress a surface (e.g. `--skip-claude`) that auto-detection would otherwise update |
701
+
702
+ Use a true tri-state: with no targeting flag a surface is detection-based; a positive
703
+ flag forces it on (and suppresses auto-detection of untargeted surfaces); `--skip-*`
704
+ forces it off. Avoid Commander’s `--no-<x>` for surfaces — it defaults the value to
705
+ `true`, which would force-install on every run.
706
+ (`tbd` itself ships `--all`, `--claude`, `--codex`, `--skip-claude`, `--skip-codex`;
707
+ `AGENTS.md` installs as part of the Codex surface.)
708
+
709
+ Keep project-local setup separate from global/user setup.
710
+ Writing `~/.codex/AGENTS.md`, `~/.agents/skills/`, or `~/.claude/skills/` should be an
711
+ explicit global install command or documented manual step, not something `setup --auto`
712
+ does silently.
713
+
714
+ #### 6.6.1 Extensible skill registries (let other packages contribute skills)
715
+
716
+ A single bundled skill is enough for most tools.
717
+ But when a tool is a **platform** that other packages extend, don’t hard-code its skill
718
+ list — expose a **registry** so any installed package can contribute a skill that the
719
+ CLI discovers at runtime.
720
+
721
+ The clean implementation is the host language’s plugin mechanism:
722
+
723
+ - **Python**: an entry-point group.
724
+ The host defines a group (e.g. `[project.entry-points."mytool.skills"]`); each plugin
725
+ package points an entry at a factory that returns a skill spec; the host enumerates
726
+ them with `importlib.metadata`. (`metaproc` does exactly this: a `metaproc.skills`
727
+ group, with `metaproc skill --list` / `--install` composing each registered skill.
728
+ Its `earnings_predictions` package registers an `eia-batch` skill that the core tool
729
+ never hard-codes.)
730
+ - **Node/TypeScript**: a documented `package.json` key or a registration API a plugin
731
+ calls on load.
732
+
733
+ Keep each registered skill a **spec** (name, two-part description, `allowed-tools`, a
734
+ baseline source, and an optional dynamic catalog function) and run them all through the
735
+ **same** `compose` and `--install` path, so every skill — first-party or third-party —
736
+ gets identical frontmatter, the `DO NOT EDIT`/format marker, and deterministic output.
737
+ This keeps the “one tool, many self-injecting commands” model open for extension without
738
+ the core tool taking a dependency on every plugin.
511
739
 
512
740
  ### 6.7 Making the CLI available: global install vs. zero-install
513
741
 
@@ -554,20 +782,36 @@ npx mytool@1.4.2 ... # not `npx mytool@latest`
554
782
  ```
555
783
 
556
784
  Global installs get the same guarantee from the lockfile/manifest; zero-install gets it
557
- only from an explicit `@version`.
785
+ only from an explicit `@version`. Generated skill instructions should use a local-first,
786
+ pinned fallback chain:
787
+
788
+ 1. Try `mycli <command>` if it is already on `PATH`.
789
+ 2. Fall back to a version-pinned runner:
790
+ - npm: `npx --yes my-package@<version> mycli <command>`
791
+ - uv: `uvx --from my-package@<version> mycli <command>`
792
+ - pipx: `pipx run my-package==<version> mycli <command>`
793
+ - Go: `go run module/path@<version> <args>`
794
+ 3. If the local command and pinned fallback both fail, stop and tell the user how to
795
+ install the CLI.
796
+
797
+ Never put an unpinned network runner such as `uvx --from my-package` or `npx my-package`
798
+ in generated skill instructions unless the user explicitly opts into that risk.
799
+ This is a supply-chain control, not just ergonomics: an unpinned runner re-resolves to
800
+ the latest published version on every run and bypasses any cool-off window.
801
+ See `tbd guidelines supply-chain-hardening` for the cross-ecosystem policy.
558
802
 
559
803
  **Current tooling (May 2026)**
560
804
 
561
805
  - **Node / TypeScript**: zero-install via `npx <pkg>@<ver>` (`-y` to skip the prompt),
562
806
  `bunx`, `pnpm dlx`, or `deno run`; persistent via `npm i -g` / a project
563
807
  devDependency.
564
- - **Python**: `uvx <pkg>@<ver>` (= `uv tool run`, bundled with Astral’s `uv`, Rust-fast,
565
- no Python prereq) or `pipx run`; persistent via `uv tool install` / `pipx install`.
566
- `uvx` reuses a persistent install if one exists.
808
+ - **Python**: `uvx --from <pkg>@<ver> <entrypoint>` (= `uv tool run`, bundled with
809
+ Astral’s `uv`, Rust-fast, no Python prereq) or `pipx run <pkg>==<ver>`; persistent via
810
+ `uv tool install` / `pipx install`. `uvx` reuses a persistent install if one exists.
567
811
  - **Go**: `go run <module>@<ver>` (compiles on the fly) or `go install`.
568
812
  - **Rust**: no first-class zero-install runner — ship **prebuilt binaries** (GitHub
569
- releases + a `curl … | sh` installer) or `cargo binstall`; `cargo install` compiles.
570
- - **Cross-language**: a prebuilt binary + install script, or a container image (Docker
813
+ releases and a `curl … | sh` installer) or `cargo binstall`; `cargo install` compiles.
814
+ - **Cross-language**: a prebuilt binary and install script, or a container image (Docker
571
815
  is emerging as the production-grade distribution for MCP servers).
572
816
 
573
817
  This mirrors how the ecosystem ships agent tooling today: **MCP servers** are most often
@@ -577,9 +821,63 @@ configs; **CLIs** like Beads offer `brew` / `npm -g` / `curl` installers, while
577
821
 
578
822
  **Recommendation**: default the skill to a **pinned zero-install invocation**
579
823
  (`uvx`/`npx <pkg>@<version>`) for maximum reach across ephemeral and cloud agents; offer
580
- **global install + a `SessionStart` bootstrap** as the optimization for persistent
824
+ **global install and a `SessionStart` bootstrap** as the optimization for persistent
581
825
  environments where the project wants lockfile-managed versions and warm-start speed.
582
826
 
827
+ ### 6.8 Publishing & discovery — make the skill installable
828
+
829
+ Most “skill registries” (May 2026) are **GitHub-repo discoverers, not gated app
830
+ stores**. You don’t submit a form; you put a spec-compliant `SKILL.md` in a public repo
831
+ and the ecosystem finds it.
832
+ The landscape worth targeting:
833
+
834
+ - **`skills.sh` / `npx skills add <owner/repo>`** (Vercel) — the cross-agent “npm for
835
+ skills”: one command installs into `.agents/skills/` and symlinks per agent (Claude
836
+ Code, Codex, Cursor, Copilot, Gemini, …). No review; ranked by install telemetry.
837
+ **This is the highest-leverage target** and needs zero extra infra.
838
+ - **GitHub-scraping indexers** (SkillsMP ~800k skills, ClaudeSkills.info, LobeHub,
839
+ claudemarketplaces.com) — auto-list public repos that contain a `SKILL.md` (often
840
+ gated on ≥2 stars). You get listed for free just by being public and discoverable.
841
+ - **Plugin marketplaces** — `.claude-plugin/marketplace.json` (Claude Code, the official
842
+ Anthropic channel) and `.agents/plugins/marketplace.json` (Codex; Codex reads both).
843
+ These are *plugin* channels: bundles of skills, MCP servers, hooks, and commands.
844
+ They are **only for publishing a bundle** — a repo-local skill already loads from
845
+ `.claude/skills/` (Claude Code) and `.agents/skills/` (Codex) **without any
846
+ manifest**, so don’t add one just to be discovered.
847
+ If you *do* emit a `marketplace.json` / `.codex-plugin/plugin.json`, treat it like any
848
+ generated artifact (§6.6): point it at the same generated `SKILL.md` payload (no body
849
+ duplication), mark it `DO NOT EDIT`, make it deterministic so re-install is a no-op,
850
+ and pick the same commit-vs-gitignore mode as the skill it references.
851
+
852
+ **The simplest publishable structure** (works for all of the above at once):
853
+
854
+ ```
855
+ your-repo/
856
+ └── skills/
857
+ └── <name>/
858
+ └── SKILL.md # spec frontmatter: name + two-part description
859
+ ```
860
+
861
+ `skills/<name>/SKILL.md` at the repo root is the universal discovery location
862
+ (`npx skills add`, the indexers, and agent installers all scan it).
863
+ That’s the whole publishing step — push it public.
864
+
865
+ **For a CLI-backed skill** (the §6 pattern), one extra rule matters: a registry installs
866
+ **only the Markdown**, never your binary.
867
+ So the published `SKILL.md` must **bootstrap its own CLI** — lead with a pinned install
868
+ line (`npm i -g <pkg>@<ver>` / `uvx --from <pkg>@<ver>`) and a one-time `setup`, and
869
+ have commands degrade with a clear “install the CLI first” message.
870
+ Treat the registry copy as a **landing page that installs the engine**, not the engine
871
+ itself. Generate this distribution `SKILL.md` from the same source as your in-repo skill
872
+ (so it can’t drift), and validate it with `npx skills-ref validate skills/<name>` before
873
+ pushing.
874
+
875
+ `tbd` does exactly this: `skills/tbd/SKILL.md` is generated at build time from the same
876
+ baseline, carries `name: tbd` and a trigger-rich description, and opens with the
877
+ `npm install -g get-tbd` and `tbd setup --auto` bootstrap — so
878
+ `npx skills add jlevy/tbd` gives an agent a working landing page, and `tbd setup` then
879
+ upgrades it to the full multi-agent install (§6.6).
880
+
583
881
  * * *
584
882
 
585
883
  ## 7. CLI vs MCP vs Skill — Choosing the Surface
@@ -628,6 +926,17 @@ Support varies:
628
926
  `beforeShellExecution`/`beforeMCPExecution`), **Windsurf** (pre-hooks can **block**
629
927
  via exit code 2), **Gemini CLI** (~12), and **opencode** (25+, with tool interception)
630
928
  all have lifecycle hooks.
929
+ - **Codex** (as of May 2026) ships a **Claude-style hooks engine that uses the same
930
+ event schema as Claude Code** — `SessionStart`, `PreCompact`/`PostCompact`,
931
+ `PreToolUse`/`PostToolUse`, `UserPromptSubmit`, `Stop`,
932
+ `SubagentStart`/`SubagentStop`, and `PermissionRequest`. Hooks load from `hooks.json`
933
+ **or an inline `[hooks]` table in `config.toml`** next to an active config layer
934
+ (`~/.codex/…` for user scope, `<repo>/.codex/…` for project scope).
935
+ Only **command** handlers run today; `prompt`/ `agent` handlers are parsed but
936
+ skipped. Because the schema matches Claude’s, a tool’s
937
+ `SessionStart`/`PreCompact`/`PostToolUse` hooks map almost 1:1 across both agents.
938
+ Repo-local hooks should resolve scripts from the git root or `.codex/`, not from
939
+ `.claude/`, so Codex setup stays independent of Claude Code setup.
631
940
  - **Aider**, **Jules**, **Zed** have no agent hooks (Aider integrates Git pre-commit
632
941
  hooks only).
633
942
 
@@ -698,7 +1007,7 @@ going:
698
1007
  - **Codex App-Server** — JSON-RPC (Thread/Turn/Item) decoupling Codex logic from client
699
1008
  surfaces; relevant only for Codex-specific integration surfaces.
700
1009
  - **Plugin marketplaces & `npx skills`** — distribution is consolidating: Claude Code
701
- plugin marketplaces (official + community), Codex plugins, and Vercel’s
1010
+ plugin marketplaces (official and community), Codex plugins, and Vercel’s
702
1011
  `npx skills add` over the skills.sh directory (cross-agent symlinks).
703
1012
  - **Routines / scheduled agents, background monitors, `/run` & `/verify` skills** —
704
1013
  newer Claude Code capabilities for autonomous, event-triggered, and app-verifying
@@ -757,10 +1066,13 @@ going:
757
1066
  - [ ] `SKILL.md` with `name` + two-part `description`
758
1067
  - [ ] Body < 500 lines; bulky material in supporting files one level deep
759
1068
  - [ ] Third-person description, trigger keywords front-loaded
760
- - [ ] Installable via commit to `.claude/skills/` and/or `npx skills add`
1069
+ - [ ] Installable via commit to `.agents/skills/`, Claude mirror at `.claude/skills/`,
1070
+ and/or `npx skills add`
761
1071
 
762
1072
  **Project**
763
1073
  - [ ] `AGENTS.md` with build/test/style/conventions (concise)
1074
+ - [ ] Managed `AGENTS.md` block uses a stable begin/end marker with a `format=fNN` field
1075
+ on the begin line
764
1076
  - [ ] `CLAUDE.md` strategy decided (symlink to `AGENTS.md`, copy, or separate)
765
1077
 
766
1078
  **CLI tool (if applicable)**
@@ -768,7 +1080,7 @@ going:
768
1080
  - [ ] Idempotent `setup --auto`; `init` for surgical config
769
1081
  - [ ] Help epilog with `IMPORTANT:` + Getting Started one-liner
770
1082
  - [ ] `prime` (status/context) and `skill` (pure docs) commands
771
- - [ ] Invocation strategy chosen (§6.7): pinned zero-install (`npx`/`uvx <pkg>@<ver>`)
1083
+ - [ ] Invocation strategy chosen (§6.7): local-first plus pinned zero-install fallback
772
1084
  by default, or global install + `SessionStart` bootstrap for cloud/ephemeral agents
773
1085
 
774
1086
  **Advanced (many subcommands / knowledge library)**
@@ -782,6 +1094,7 @@ going:
782
1094
  - [ ] Decide target agents; add per-agent files only where needed
783
1095
  - [ ] MCP server only if no CLI fits, or for OAuth/multi-tenant/remote
784
1096
  - [ ] Marker-bounded multi-agent install; “DO NOT EDIT” on generated files
1097
+ - [ ] Existing installs upgrade item-by-item without rewriting user-owned content
785
1098
 
786
1099
  **Security**
787
1100
  - [ ] Third-party skills vetted, scanned, and pinned
@@ -861,3 +1174,7 @@ going:
861
1174
  - Supply-chain / dependency currency: `tbd guidelines bun-monorepo-patterns` or
862
1175
  `pnpm-monorepo-patterns`
863
1176
  - Testing: `tbd guidelines general-testing-rules`
1177
+
1178
+ <!-- This document follows common-doc-guidelines.md.
1179
+ See github.com/jlevy/practical-prose and review guidelines before editing.
1180
+ -->
@@ -77,3 +77,7 @@ ops: Update issue status for auth feature
77
77
  ops: Sync beads with remote
78
78
  process: Add TDD guidelines for agent workflows
79
79
  ```
80
+
81
+ <!-- This document follows common-doc-guidelines.md.
82
+ See github.com/jlevy/practical-prose and review guidelines before editing.
83
+ -->