canned-prompts/workplans/CANP-WP-0003-registry-naming-residual.md
tegwick e1889b41a1 CANP-WP-0003: name the default registry default
Section 20.1 takes a registry's name from its directory basename, so the
reference tool's default store at ~/.canned-prompts/registry was named
`registry` — giving `registry:practice/thing` as a qualified reference.

The workplan had recorded this as reading poorly in one output line. It was
understated: the name reaches qualified references, the on-disk catalog layout
(catalog/registry/...), and index.yaml rows (registry: registry). Once packages
are installed and inclusions recorded, changing it becomes a migration rather
than an edit.

Renaming the directory to ~/.canned-prompts/default fixes it with no special
case in code, nothing written into the user's store, and no second naming
mechanism competing with section 20.1's manifest.

check_legacy_registry refuses to silently create a fresh empty store beside a
populated ~/.canned-prompts/registry — that failure would have been worse than
the wart being fixed. It names the exact mv, and the --registry flag for
keeping the old store. The check fires only for the default path; an explicit
--registry is never second-guessed.

Tests 95 -> 99.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bjefh8NUiEiahN4JLwoSKM

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 388925@bnt-lap001
Assistant-Session: 3507023f-e0fd-4a1e-9d90-a0d4217d1502
2026-09-06 19:32:30 +02:00

81 lines
3.1 KiB
Markdown

---
id: CANP-WP-0003
type: workplan
title: "Default registry name reads as 'registry:'"
domain: agents
repo: canned-prompts
status: finished
owner: codex
topic_slug: practice
created: "2026-09-06"
updated: "2026-09-06"
state_hub_workstream_id: "d7865fc8-a618-5033-a8de-947c59715cf6"
---
# Default registry name reads as `registry:`
Residual from `CANP-WP-0002` (`origin: residual`, `origin_ref: CANP-WP-0002`).
## Give the default registry a better name
```task
id: CANP-WP-0003-T01
status: done
priority: low
state_hub_task_id: "ead2d409-2b80-5f50-9f0f-a397822ba2ae"
```
`CANP-WP-0002-T02` made a registry's name come from its `registry.yaml`, and
otherwise from its directory basename (§ 20.1). The reference tool's default
registry lives at `~/.canned-prompts/registry`, so its basename-derived name is
`registry`, and every install from it reads:
```text
installed registry:practice/pqrst-estimate@0.1.0
```
That is honest — it is genuinely what the directory is called — but it reads
poorly, and `registry:` is a confusing qualifier for the one registry most
users will ever see.
Deliberately not fixed in `CANP-WP-0002`: special-casing the default path to
produce a prettier name would be exactly the kind of magic the § 20.1 rule was
written to avoid, and it was not worth an exception mid-task.
Options worth weighing:
1. Write a starter `registry.yaml` when the default registry is first created,
naming it something like `default` or `local-registry`. Uses the documented
mechanism rather than bypassing it; the cost is a tool writing a file into
a store the user may consider theirs.
2. Rename the default directory itself, so the basename is already good.
Changes an existing on-disk layout.
3. Accept it and document it. Zero code, and the escape hatch — add a
`registry.yaml` — already exists and is documented.
Option 3 is the current state. Pick deliberately rather than by default.
## Outcome
**Decision (operator, 2026-09-06): option 2** — rename the default directory to
`~/.canned-prompts/default`, so the § 20.1 basename rule produces a good name
with no special case, no file written into the user's store, and no second
naming mechanism.
**The cost of deferring had been understated.** The workplan recorded this as
reading poorly in one output line. It is not only display: the name reaches
qualified references, the on-disk catalog layout (`catalog/registry/...`) and
`index.yaml` rows (`registry: registry`). Once packages are installed and
inclusions recorded, changing it is a migration rather than an edit — which is
an argument for deciding early, not late.
Delivered:
- `default_registry()` returns `~/.canned-prompts/default`.
- `check_legacy_registry` refuses to silently create a fresh empty store beside
a populated `~/.canned-prompts/registry`. It names the exact `mv`, and the
`--registry` flag for keeping the old one. Silently starting empty would have
been worse than the wart being fixed.
- The check fires only for the default path; an explicitly passed `--registry`
is never second-guessed.
- Docs updated in both READMEs. Tests 95 → 99.