feat(claude): user_config defaults in command/agent prompts + governance alignment scan#396
Conversation
tractorjuice
left a comment
There was a problem hiding this comment.
Verdict: Request changes — must not merge as-is
The intent (default Document Control fields from user_config) is sensible, but this PR is based on a 112-commit-stale tip of main despite claiming "rebuilt from current main to avoid cross-PR regressions." Merging would silently revert four shipped features.
Blockers
-
Stale base — reverts large amounts of merged work. Merge-base with
mainis7f34c35c(between v4.7/v4.8). The diff againsthooks.jsonundoes:- PR #467 / v4.20.0 —
args: string[]exec-form migration (all 25+ entries flipped back to shell-string form, contradicting the v2.1.139+ floor we declared). - PR #470 —
continueOnBlock: trueon observational PostToolUse hooks (stripped). - PR #475 / issue #472 —
PostCompact→postcompact-rehydrate.mjsevent registration (deleted). - PR #446 / v4.18.2 —
PreToolUse: Agent→inject-agent-context.mjs(deleted; this is the fix for the Skill/Agent-dispatch context-injection gap). - PR #430 — telemetry on
.*PostToolUse + the entireTaskCreatedevent (deleted). - Provenance stamping for Write/Edit on
projects/**(deleted). - `allow-plugin-internals.mjs` PreToolUse entry (deleted).
Plus the curated `description` in `hooks.json` is reverted to a stale string. Rebase onto current `main` before any other review can be meaningful.
- PR #467 / v4.20.0 —
-
Dead 748-line hook. `arckit-claude/hooks/governance-scan.mjs` is added but never registered in `hooks.json` — no matcher block for it exists. The script will never run. Substantively, ~700 of those 748 lines duplicate the existing analyze pre-processor logic in `graph-inject.mjs` (coverage tables, requirements inventory, vendor scan, risk severity). Only the ~30-line "Plugin Default Alignment Gaps" block is novel; that section, if we want it, belongs inside `graph-inject.mjs`, not as a new top-level hook.
-
Wrong `user_config` field for owner. Across ~40 commands and 8 agents, `[OWNER_NAME_AND_ROLE]` is being defaulted to `${user_config.organisation_name}`. The schema in `plugin.json` defines `organisation_name` as the org string (e.g. "HM Revenue & Customs"); `[OWNER_NAME_AND_ROLE]` is a person + role (e.g. "Jane Doe, Chief Architect"). They're not interchangeable. Either (a) drop this default and keep the prompt-the-user path, or (b) add a new `default_owner` field to `userConfig`. The same misuse appears in the new hook's "Owner missing or does not reference configured organisation" check (`governance-scan.mjs:694–700`).
Important issues
-
Generic mode on UK-by-definition commands is meaningless. `tcop`, `service-assessment`, `secure`, `atrs`, `ai-playbook` are UK-specific commands by name and purpose. Adding an "if Generic, skip GDS/TCoP/NCSC CAF references" branch hollows them out (a TCoP review with TCoP removed isn't a thing). Generic-mode toggles make sense on the framework-neutral commands (`requirements`, `adr`, `principles`, `risk`, `sobc`, `data-model`, `diagram`, etc.) but not the UK-compliance commands — non-UK jurisdictions are already served by the community overlays. Drop the mode block from the UK-compliance commands.
-
`secure.md` Step-10 numbering collision. Two steps are renumbered to `10.` after the edits (existing "Government Cyber Security Profession alignment" and "Cyber Security Standard compliance"). Verify the numbered list still renders cleanly.
Minor
- The PR body's "rebuilt from current `main`" claim should be removed or corrected — it materially misled reviewers on first pass.
- Consider gating the `user_config.organisation_name` default behind explicit user consent on first use — silently stamping an org name into every doc owner field is a surprise.
What I'd want before re-review
- Rebase onto current `main` and re-diff `hooks.json` (should be zero lines changed there unless you're actually adding a new registered hook).
- Either register `governance-scan.mjs` or fold its novel "Plugin Default Alignment Gaps" section into `graph-inject.mjs` (and delete the rest as duplication).
- Decide on `[OWNER_NAME_AND_ROLE]`: drop the `organisation_name` default, or add a new `default_owner` field. Don't conflate the two.
- Strip the governance-mode block from the UK-compliance commands; keep it on the framework-neutral ones.
Summary
This PR is a scoped v2 follow-up to the previous
feat/userconfig-wiringattempt, rebuilt from currentmainto avoid cross-PR regressions.It keeps only the intended architecture:
user_config-based defaulting guidance in Claude command bodies.arckit-claude/hooks/governance-scan.mjschecks for plugin default alignment gaps (Classification / Owner).Included in This PR
1) Command Body Updates (Claude)
Command text now includes guidance to:
[CLASSIFICATION]and[OWNER_NAME_AND_ROLE]from\${user_config.*}where available.2) Agent Body Updates (Claude)
Agent prompts follow the same pattern:
\${user_config.*}defaults in prompt body logic.3) Governance Scan Hook
Introduces
arckit-claude/hooks/governance-scan.mjsbehavior that:CLAUDE_PLUGIN_OPTION_*environment variables.Explicitly Out of Scope
To keep this PR merge-safe and aligned with prior review feedback, the following are intentionally excluded:
\${user_config.*}substitution changes.scripts/converter.pyplaceholder rewrite/copy flows.arckit-paperclip/script reintroductions or related regressions.arckit-claude/commands/pages.mdarckit-claude/templates/pages-template.htmlarckit-claude/hooks/allow-mcp-tools.mjsRationale
user_configinterpolation is reliable in command/agent body text, but not in arbitrary template file contents loaded at runtime.This PR therefore applies defaults only where substitution is guaranteed and avoids template-level substitution risk.
Validation Notes
mainto avoid silent reverts.