diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 5e732892..d7dac492 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -16,13 +16,13 @@ { "name": "han-communication", "source": "./han-communication", - "description": "Foundational communication plugin for the Han suite. Owns the canonical readability standard, writing-voice profile, and explanation standard, the readability-guidance skill that surfaces the first two into a calling skill's context for in-voice drafting, the explanation-guidance skill that surfaces the third at the point a run talks to a person, the readability-editor agent that runs the adversarial rewrite, and the edit-for-readability skill. Depends on nothing and sits beneath every other plugin; the plugins that produce prose output depend on it.", + "description": "Foundational communication plugin for the Han suite. Owns the canonical readability standard, writing-voice profile, and explanation standard, the readability-guidance skill that surfaces the first two into a calling skill's context for in-voice drafting, the explanation-guidance skill that surfaces the third at the point a run talks to a person, the readability-editor agent that runs the adversarial rewrite, and the edit-for-readability skill. Depends on han-core for the shared configuration loader and sits beneath every other prose-producing plugin, which depend on it.", "version": "1.2.1" }, { "name": "han-core", "source": "./han-core", - "description": "The shared foundation of the Han suite: the specialist agent roster the other plugins dispatch, the project-discovery skill with its project-scanner agent, and the canonical evidence and YAGNI rule files. The documentation skills live in han-documentation, the pre-planning research skills in han-research, the planning skills in han-planning, and the coding skills in han-coding; each depends on han-core.", + "description": "The shared foundation of the Han suite: the specialist agent roster the other plugins dispatch, the load-han-config skill every other skill invokes to read .han/config.md once per run, the project-discovery skill with its project-scanner agent, and the canonical evidence and YAGNI rule files. The documentation skills live in han-documentation, the pre-planning research skills in han-research, the planning skills in han-planning, and the coding skills in han-coding; each depends on han-core.", "version": "3.2.0" }, { @@ -58,13 +58,13 @@ { "name": "han-reporting", "source": "./han-reporting", - "description": "Reporting and summary skills for the Han suite. Turns feature specifications into plain-language stakeholder summaries (also called executive or business summaries) with diagrams, for sharing with non-technical stakeholders before implementation kicks off.", + "description": "Reporting and summary skills for the Han suite. Turns feature specifications into plain-language stakeholder summaries (also called executive or business summaries) with diagrams, for sharing with non-technical stakeholders before implementation kicks off. Depends on han-communication and han-core.", "version": "2.2.2" }, { "name": "han-feedback", "source": "./han-feedback", - "description": "Post-session feedback skill for the Han suite. Captures structured observations, ratings, and improvement ideas on the Han skills you ran in a session and optionally posts them as a GitHub issue to testdouble/han. Opt-in: installed on its own, not pulled in by the han meta-plugin.", + "description": "Post-session feedback skill for the Han suite. Captures structured observations, ratings, and improvement ideas on the Han skills you ran in a session and optionally posts them as a GitHub issue to testdouble/han. Depends on han-core for the shared configuration loader. Opt-in: installed on its own, not pulled in by the han meta-plugin.", "version": "2.0.2" }, { @@ -76,7 +76,7 @@ { "name": "han-linear", "source": "./han-linear", - "description": "Linear-facing extensions to the Han suite. Adds work-items-to-linear, which creates one Linear issue per slice from a work-items file. Works through the Linear MCP server and requires it to be configured. Depends on no other Han plugin. Opt-in: installed on its own, not pulled in by the han meta-plugin.", + "description": "Linear-facing extensions to the Han suite. Adds work-items-to-linear, which creates one Linear issue per slice from a work-items file. Works through the Linear MCP server and requires it to be configured. Depends on han-core for the shared configuration loader. Opt-in: installed on its own, not pulled in by the han meta-plugin.", "version": "1.1.2" }, { @@ -88,7 +88,7 @@ { "name": "han-plugin-builder", "source": "./han-plugin-builder", - "description": "Guidance for building Claude Code skills, agents, and plugins. The guidance skill answers authoring questions and, run with init, vendors the full guidance set into a repo as a path-scoped rule index so the right guidance surfaces while editing skill and agent files. Opt-in and dependency-free: installed on its own, not pulled in by the han meta-plugin.", + "description": "Guidance for building Claude Code skills, agents, and plugins. The guidance skill answers authoring questions and, run with init, vendors the full guidance set into a repo as a path-scoped rule index so the right guidance surfaces while editing skill and agent files. Opt-in: depends on han-core for the shared configuration loader; installed on its own, not pulled in by the han meta-plugin.", "version": "2.2.1" } ] diff --git a/CLAUDE.md b/CLAUDE.md index 4e8bab86..17755f74 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,9 +7,9 @@ plugin beneath every other: it owns the canonical readability standard, the writ standard for talking to a reader who will not implement the work, plus the inline `readability-guidance` skill that surfaces the first two, the inline `explanation-guidance` skill that surfaces the third, the `edit-for-readability` skill, the `readability-editor` agent, and the `han-readability` and `han-concise` output styles that apply the first two to -every turn of a session; it depends on nothing and every prose-producing plugin depends on it), `han-core` (the shared foundation: the +every turn of a session; it depends on `han-core` for the shared configuration loader and every prose-producing plugin depends on it), `han-core` (the shared foundation: the specialist agent roster the rest of the suite dispatches — every shared agent except the `readability-editor`, the -`research-analyst`, and the `discussion-facilitator` — plus the `project-discovery` skill, the `pairing` collaborative working mode, and the canonical rule files; depends on no other Han plugin), +`research-analyst`, and the `discussion-facilitator` — plus the `load-han-config` skill every other skill invokes to bring both `.han/config.md` files into context once per run, the `project-discovery` skill, the `pairing` collaborative working mode, and the canonical rule files; depends on no other Han plugin, and every other plugin depends on it), `han-documentation` (the documentation skills: `project-documentation`, `architectural-decision-record`, and `runbook`; depends on `han-communication` and `han-core` and is bundled by the `han` meta-plugin), `han-research` (the pre-planning knowledge-work skills — `research`, `gap-analysis`, and `issue-triage` — plus the `research-analyst` @@ -26,16 +26,16 @@ testing, investigating, and standardizing it with `code-review`, `code-overview` `architectural-analysis`, `automated-test-planning`, `manual-test-planning`, `investigate`, and `coding-standard`; depends on `han-communication` and `han-core` and is bundled by the `han` meta-plugin), -`han-github` (GitHub-facing skills), `han-reporting` (reporting and summary skills; depends only on -`han-communication`), `han` (a meta-plugin that installs `han-communication`, `han-core`, `han-documentation`, +`han-github` (GitHub-facing skills), `han-reporting` (reporting and summary skills; depends on +`han-communication` and `han-core`), `han` (a meta-plugin that installs `han-communication`, `han-core`, `han-documentation`, `han-research`, `han-planning`, `han-coding`, `han-github`, and `han-reporting` via dependencies), -`han-feedback` (an opt-in plugin carrying the post-session feedback skill, which depends on no other Han plugin and is +`han-feedback` (an opt-in plugin carrying the post-session feedback skill, which depends on `han-core` and is deliberately _not_ bundled by the `han` meta-plugin, so it is installed separately), `han-atlassian` (an opt-in plugin carrying the Atlassian skills — Confluence publishing and work-items-to-Jira — which depends on `han-communication`, `han-core`, `han-documentation`, `han-planning`, and `han-coding` because its wrapper skills run skills from each, requires a configured Atlassian MCP server, and is likewise _not_ bundled by the `han` meta-plugin), `han-linear` (an opt-in -plugin carrying the work-items-to-Linear skill, which depends on no other Han plugin, requires a configured Linear MCP +plugin carrying the work-items-to-Linear skill, which depends on `han-core`, requires a configured Linear MCP server, and is likewise _not_ bundled by the `han` meta-plugin), `han-ddd` (an opt-in plugin carrying the `ddd-analysis` skill plus the `bounded-context-critic`, `bounded-context-modeler`, `business-capability-analyst`, `domain-language-analyst`, `domain-ownership-analyst`, and `domain-visualizer` @@ -45,7 +45,7 @@ evaluating semantic bounded context models, producing a domain and context map, `han-communication` and `han-core`; NOT bundled by the `han` meta-plugin), and `han-plugin-builder` (an opt-in plugin carrying the guidance for building skills and plugins, plus the interview-driven `skill-builder` and `agent-builder` skills that author a new skill or agent from -scratch and review it against that guidance; it depends on nothing and is also deliberately _not_ bundled by the `han` +scratch and review it against that guidance; it depends on `han-core` and is also deliberately _not_ bundled by the `han` meta-plugin). ## Creating skills, agents, or other plugin aspects @@ -75,22 +75,22 @@ han-plugin-builder skill: │ ├── README.md # Light meta-plugin front door (no skills/agents sections) │ └── .claude-plugin/ │ └── plugin.json -├── han-communication/ # Foundational plugin: readability-guidance + explanation-guidance + edit-for-readability skills, readability-editor agent, han-readability + han-concise output styles, and the canonical readability-rule.md + writing-voice.md + explanation-rule.md (depends on nothing; every prose-producing plugin depends on it) +├── han-communication/ # Foundational plugin: readability-guidance + explanation-guidance + edit-for-readability skills, readability-editor agent, han-readability + han-concise output styles, and the canonical readability-rule.md + writing-voice.md + explanation-rule.md (depends on han-core; every prose-producing plugin depends on it) │ ├── README.md # Light front door + scent-line skill and agent lists │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── .codex-plugin/ │ │ └── plugin.json # Codex-format manifest; every han-* plugin carries one, han/ is excluded (omitted from the entries below) -│ ├── scripts/ # han-config-dir.sh, a symlink to the repo-root script; every plugin except han carries one (omitted from the entries below), and each skill's `personal config directory` probe runs it │ ├── agents/ # readability-editor agent definition │ ├── skills/ # readability-guidance + explanation-guidance (both inline, each surfaces one standard) + edit-for-readability │ ├── output-styles/ # han-readability.md (the readability rule and writing voice distilled into a selectable output style) + han-concise.md (the same, plus a brevity property that is this style's own addition) (auto-discovered default location; no plugin.json field) │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md + docs/agents/readability-editor.md + docs/output-styles/{han-readability,han-concise}.md -│ └── references/ # Canonical readability-rule.md + writing-voice.md + explanation-rule.md (owned here; no vendored copies elsewhere), beside a vendored config-rule.md -├── han-core/ # Core plugin: the shared specialist agent roster (all agents except readability-editor and research-analyst) + project-discovery + pairing (depends on no other Han plugin) +│ └── references/ # Canonical readability-rule.md + writing-voice.md + explanation-rule.md (owned here; no vendored copies elsewhere), with no vendored copies +├── han-core/ # Core plugin: the shared specialist agent roster (all agents except readability-editor and research-analyst) + load-han-config + project-discovery + pairing (depends on no other Han plugin; every other plugin depends on it) │ ├── README.md # Light front door; skills and agents grouped by purpose │ ├── .claude-plugin/ │ │ └── plugin.json +│ ├── scripts/ # load-han-config.sh, the probe script behind the load-han-config skill, with its Bats tests beside it │ ├── agents/ # Agent definitions (.md with frontmatter) │ ├── skills/ # project-discovery and pairing skill directories, each with SKILL.md (+ references/ where used) │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md + docs/agents/{name}.md @@ -101,7 +101,7 @@ han-plugin-builder skill: │ │ └── plugin.json │ ├── skills/ # Documentation skill directories, each with SKILL.md + references/ │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md -│ └── references/ # Cross-skill reference files vendored for han-documentation skills (yagni-rule.md, evidence-rule.md, config-rule.md) +│ └── references/ # Cross-skill reference files vendored for han-documentation skills (yagni-rule.md, evidence-rule.md) ├── han-research/ # Research plugin: research, gap-analysis, issue-triage + the research-analyst agent (depends on han-communication and han-core; bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills and agent lists │ ├── .claude-plugin/ @@ -109,7 +109,7 @@ han-plugin-builder skill: │ ├── agents/ # research-analyst agent definition │ ├── skills/ # Research skill directories, each with SKILL.md + references/ │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md + docs/agents/research-analyst.md -│ └── references/ # Cross-skill reference files vendored for han-research skills (yagni-rule.md, evidence-rule.md, config-rule.md) +│ └── references/ # Cross-skill reference files vendored for han-research skills (yagni-rule.md, evidence-rule.md) ├── han-planning/ # Planning plugin: plan-a-feature, plan-a-change, plan-implementation, plan-a-phased-build, plan-work-items, iterative-plan-review, reassess-approach (the skills for planning before implementation) + the discussion-facilitator agent (depends on han-communication and han-core; bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills and agent lists │ ├── .claude-plugin/ @@ -117,43 +117,39 @@ han-plugin-builder skill: │ ├── agents/ # discussion-facilitator agent definition │ ├── skills/ # Planning skill directories, each with SKILL.md + references/ + scripts/ │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md + docs/agents/discussion-facilitator.md -│ └── references/ # Both kinds: han-planning-owned canonical files (planning-boundary-rule.md, scope-justification-rule.md, operator-escalation-rule.md, contract-pinning-rule.md, synthesis-failure-rule.md) beside vendored copies (yagni-rule.md, evidence-rule.md, config-rule.md, collaborative-stop-rule.md). Each owned file opens by saying so; do not overwrite one in a re-sync sweep +│ └── references/ # Both kinds: han-planning-owned canonical files (planning-boundary-rule.md, scope-justification-rule.md, operator-escalation-rule.md, contract-pinning-rule.md, synthesis-failure-rule.md) beside vendored copies (yagni-rule.md, evidence-rule.md, collaborative-stop-rule.md). Each owned file opens by saying so; do not overwrite one in a re-sync sweep ├── han-coding/ # Coding plugin: tdd, refactor, restructure, design-an-api, code-review, code-overview, code-walkthrough, architectural-analysis, automated-test-planning, manual-test-planning, investigate, coding-standard (the skills for working in code; depends on han-communication and han-core; bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills list │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── skills/ # Coding-facing skill directories, each with SKILL.md + references/ (+ scripts/ where used) │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md -│ └── references/ # Cross-skill reference files vendored for han-coding skills (yagni-rule.md, evidence-rule.md, config-rule.md, collaborative-stop-rule.md) +│ └── references/ # Cross-skill reference files vendored for han-coding skills (yagni-rule.md, evidence-rule.md, collaborative-stop-rule.md) ├── han-github/ # GitHub plugin: post-code-review-to-pr, update-pr-description, work-items-to-issues (depends on han-communication, han-core, and han-coding, whose code-review skill post-code-review-to-pr wraps) │ ├── README.md # Light front door + scent-line skills list │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── skills/ # GitHub-facing skill directories, each with SKILL.md + scripts/ (+ references/ where used) │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md -│ └── references/ # Vendored config-rule.md ├── han-reporting/ # Reporting plugin: stakeholder-summary, html-summary (depends on han-communication for the readability standard) │ ├── README.md # Light front door + scent-line skills list │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── skills/ # Reporting skill directories, each with SKILL.md + references/ (html-summary adds scripts/ + assets/) │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md -│ └── references/ # Vendored config-rule.md -├── han-feedback/ # Opt-in feedback plugin: han-feedback (depends on no other Han plugin; NOT bundled by the han meta-plugin) +├── han-feedback/ # Opt-in feedback plugin: han-feedback (depends on han-core; NOT bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills list │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── skills/ # Feedback skill directory (han-feedback) with SKILL.md │ ├── docs/ # In-plugin long-form docs: docs/skills/han-feedback.md -│ └── references/ # Vendored config-rule.md ├── han-atlassian/ # Opt-in Atlassian plugin: markdown-to-confluence, project-documentation-to-confluence, investigate-to-confluence, code-overview-to-confluence, plan-a-feature-to-confluence, work-items-to-jira (depends on han-communication, han-core, han-documentation, han-planning, han-coding; requires the Atlassian MCP server; NOT bundled by the han meta-plugin). Carries README.md + docs/skills/ like the other layers. -├── han-linear/ # Opt-in Linear plugin: work-items-to-linear (depends on no other Han plugin; requires the Linear MCP server; NOT bundled by the han meta-plugin) +├── han-linear/ # Opt-in Linear plugin: work-items-to-linear (depends on han-core; requires the Linear MCP server; NOT bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills list │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── skills/ # Linear skill directory, with SKILL.md + references/ │ ├── docs/ # In-plugin long-form docs: docs/skills/work-items-to-linear.md -│ └── references/ # Vendored config-rule.md ├── han-ddd/ # Opt-in DDD analysis plugin: ddd-analysis skill + bounded-context-critic, bounded-context-modeler, business-capability-analyst, domain-language-analyst, domain-ownership-analyst, and domain-visualizer agents (depends on han-communication and han-core; NOT bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills and agent lists │ ├── .claude-plugin/ @@ -163,14 +159,13 @@ han-plugin-builder skill: │ ├── agents/ # Agent definitions (.md with frontmatter) │ ├── skills/ # ddd-analysis skill directory, with SKILL.md + references/ │ ├── docs/ # In-plugin long-form docs: docs/skills/ddd-analysis.md + docs/agents/{name}.md -│ └── references/ # Vendored config-rule.md, evidence-rule.md, yagni-rule.md -├── han-plugin-builder/ # Opt-in plugin-building plugin: guidance, skill-builder, agent-builder (depends on nothing; NOT bundled by the han meta-plugin) +│ └── references/ # Vendored evidence-rule.md, yagni-rule.md +├── han-plugin-builder/ # Opt-in plugin-building plugin: guidance, skill-builder, agent-builder (depends on han-core; NOT bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills list │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── skills/ # guidance skill (SKILL.md + assets/ + scripts/ + references/, the authoring guidance by topic); skill-builder and agent-builder (SKILL.md each, the interview-driven builders) │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md -│ └── references/ # Vendored config-rule.md ├── docs/ # Operator-facing documentation (cross-plugin surfaces; long-form docs now live in each plugin) │ ├── concepts.md │ ├── configuration.md # The .han/config.md configuration guide, personal and project (canonical annotated example) @@ -192,7 +187,6 @@ han-plugin-builder skill: │ ├── templates/ # Templates and coverage rule for long-form docs │ ├── plans/ # Plan documents (one folder per plan; nested research lives inside) │ └── research/ # Standalone research reports not tied to a specific plan -├── scripts/ # Repo-root shared scripts every plugin symlinks to (han-config-dir.sh, with its Bats tests beside it) ├── test/ # Harness-level Bats checks (a script's own tests sit beside it) └── images/ # Banner and graphics for README ``` @@ -201,17 +195,20 @@ The plugins are shipped from `han-communication/`, `han-core/`, `han-documentati `han-planning/`, `han-coding/`, `han-github/`, `han-reporting/`, `han-feedback/`, `han-atlassian/`, `han-linear/`, `han-ddd/`, and `han-plugin-builder/`; the `han/` meta-plugin pulls in `han-communication`, `han-core`, `han-documentation`, `han-research`, `han-planning`, `han-coding`, `han-github`, and `han-reporting` through its `dependencies`. -`han-communication` is the foundational layer beneath every other plugin: it depends on nothing and owns the canonical +`han-communication` is the foundational layer for prose beneath every other plugin: it depends on `han-core` for the +shared configuration loader and owns the canonical readability standard plus the explanation standard that governs what a run says to a person in a turn, and every plugin that produces prose output (`han-documentation`, `han-research`, `han-planning`, `han-coding`, `han-github`, `han-reporting`, and the opt-in `han-atlassian`) declares a direct dependency on it. `han-documentation`, `han-research`, `han-planning`, and `han-coding` depend on `han-communication` and `han-core` and are bundled by the meta-plugin, as are `han-github` and `han-reporting` -(`han-reporting` depends only on `han-communication`). `han-feedback`, `han-atlassian`, `han-linear`, and `han-ddd` are +(`han-reporting` depends on `han-communication` and `han-core`). `han-feedback`, `han-atlassian`, `han-linear`, and `han-ddd` are deliberately left out of the meta-plugin, so each is opt-in and installed on its own: `han-atlassian` depends on `han-communication`, `han-core`, `han-documentation`, `han-planning`, and `han-coding` and requires a configured -Atlassian MCP server; `han-feedback` and `han-linear` depend on no other Han plugin, and `han-linear` requires a -configured Linear MCP server; `han-ddd` depends on `han-communication` and `han-core`. `han-plugin-builder` depends on nothing and is likewise opt-in and installed on its own. The +Atlassian MCP server; `han-feedback` and `han-linear` depend on `han-core`, and `han-linear` requires a +configured Linear MCP server; `han-ddd` depends on `han-communication` and `han-core`. `han-plugin-builder` depends on `han-core` and is likewise opt-in and installed on its own. +Every plugin therefore depends on `han-core`, directly, because its `load-han-config` skill is the one place a run +reads `.han/config.md`. The contributor-facing authoring guidance (how to build skills, agents, and plugins) lives inside `han-plugin-builder/skills/guidance/references/`, not under `docs/`; running the `guidance` skill with `init` vendors all three plugin-building skills into any repo's `.claude/skills/` under a `plugin-` prefix (`plugin-guidance`, @@ -253,9 +250,10 @@ such as Claude, should be referenced here. person carries in their Claude Code configuration directory and a consuming project carries at its root, to set an output base directory, a default swarm size, a writing-voice profile, and extra agents for Han skills. The project file overrides the personal one setting by setting. Holds the single canonical annotated schema example. -- **[han-core/references/config-rule.md](./han-core/references/config-rule.md).** The canonical interpretation contract - (schema tokens, precedence, containment, pool-join, degradation) every participating skill applies. Vendored - byte-identical into every skill-carrying plugin's `references/`; edit the canonical copy and re-sync the others. +- **[han-core/references/config-rule.md](./han-core/references/config-rule.md).** The interpretation contract + (schema, precedence, path resolution, extra agents, degradation) every skill applies to the two `.han/config.md` + files. The single copy: `han-core:load-han-config` prints it into every run's context under its own heading, so no + plugin vendors it and no skill links it by path. ### Collaborative working mode @@ -350,7 +348,7 @@ Every file in this section is owned by `han-planning`, not vendored. Each opens ## Project Discovery - Default branch: `main` -- Language: Markdown (skill, agent, and doc content) and Bash (skill `scripts/`, plus the shared repo-root `scripts/`) +- Language: Markdown (skill, agent, and doc content) and Bash (skill and plugin `scripts/`) - Package manager: npm. The root `package.json` manages dev tooling only; there is no application build or dev server. - Install: `npm install` installs prek, Prettier, and Bats locally, with nothing on the global PATH. - Lint: `npm run lint` runs `prek run --all-files` (Prettier, ShellCheck, and file-hygiene hooks). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47f6895c..4649c416 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,7 +98,7 @@ change goes before you scaffold anything. (For the user-facing version of this m writing-voice profile, and the explanation standard for talking to a reader who will not implement the work, plus the `readability-guidance` and `explanation-guidance` skills that surface them, the `edit-for-readability` skill, and the `readability-editor` agent, and the `Han Readability` and `Han Concise` output styles in - `han-communication/output-styles/`. It depends on nothing; the plugins that produce prose output depend on it. A component goes here only when it is part of a shared + `han-communication/output-styles/`. It depends on `han-core` for the shared configuration loader; the plugins that produce prose output depend on it. A component goes here only when it is part of a shared communication capability: how output reads, or how a run talks to a person. - **`han-core`** carries the shared specialist agent roster — **every agent in the suite except the `readability-editor`** (which lives in `han-communication`), **the `research-analyst`** (which lives in @@ -141,7 +141,7 @@ change goes before you scaffold anything. (For the user-facing version of this m `domain-ownership-analyst`, `domain-visualizer`). A skill or agent goes here when it does strategic DDD analysis of an existing codebase. It is opt-in and depends on `han-communication` and `han-core`. - **`han-plugin-builder`** carries the contributor authoring guidance (the `guidance` skill and its reference set, plus - the interview-driven `skill-builder` and `agent-builder` skills). It is opt-in and depends on nothing. Edit it when + the interview-driven `skill-builder` and `agent-builder` skills). It is opt-in and depends on `han-core` for the shared configuration loader. Edit it when you change how skills, agents, or plugins are built; it is not where product-facing skills go. - **`han`** is the meta-plugin. It has no components of its own; it depends on `han-communication`, `han-core`, `han-documentation`, `han-research`, `han-planning`, `han-coding`, `han-github`, and `han-reporting` so one install @@ -179,10 +179,11 @@ Long-form docs always live under `docs/` regardless of which plugin the entity s - Frontmatter with `name`, `description`, `allowed-tools`. See [skill-description-frontmatter.md](./han-plugin-builder/skills/guidance/references/skill-building-guidance/skill-description-frontmatter.md). - Body: numbered steps, `${CLAUDE_SKILL_DIR}` paths for script references, extracted references under `references/`. - - If the skill reads `.han/config.md`, copy the `personal config directory` probe and its matching - `Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh")` grant from any existing skill. The probe must - run that script rather than name an environment variable, or the loader refuses it and the skill never runs. - See [context-injection-commands.md](./han-plugin-builder/skills/guidance/references/skill-building-guidance/context-injection-commands.md). + - Give its `## Project Context` block the one line every other skill carries, byte for byte: "Resolve configuration + with `han-core:load-han-config` if you have not already this run.", and list `Skill` in `allowed-tools`. Do not + copy a config probe or the resolver grant; only `han-core/skills/load-han-config/SKILL.md` carries those. + `han-core/scripts/load-han-config.bats` checks every shipped skill for the line and the grant, and names the one skill that + carries neither (`explanation-guidance`), so a new skill that must not read configuration is added there. 3. Copy [the skill template](./docs/templates/skill-long-form-template.md) into `{plugin}/docs/skills/{name}.md` and fill it in. Every skill gets a long-form doc. If the skill runs inline in a calling skill's context and returns no artifact, follow the inline-guidance variant in the diff --git a/README.md b/README.md index 2496a60c..5178eafa 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,8 @@ codex plugin add han-reporting@han ``` Install `han-feedback`, `han-atlassian`, `han-linear`, `han-ddd`, or `han-plugin-builder` separately when you want those -opt-in packages. Because Codex resolves no dependencies, install `han-communication` alongside `han-atlassian` (its wrapped +opt-in packages. Because Codex resolves no dependencies, install `han-core` alongside any of them (every skill reads +`.han/config.md` through its `load-han-config` skill), and `han-communication` alongside `han-atlassian` (its wrapped prose-producing skills source the shared readability standard from it). ## Documentation diff --git a/docs/choosing-a-han-plugin.md b/docs/choosing-a-han-plugin.md index 762bc21a..4ce11875 100644 --- a/docs/choosing-a-han-plugin.md +++ b/docs/choosing-a-han-plugin.md @@ -33,9 +33,10 @@ description of what it does. The `han` meta-plugin is a convenience wrapper that - **[`han-communication`](../han-communication/README.md).** The foundational plugin beneath every other. Owns the canonical readability standard and the explanation standard for talking to someone who will not implement the work, plus the skills and agent that apply them and the `Han Readability` and `Han Concise` output styles that apply the - readability standard to a whole session. Bundled; depends on nothing. + readability standard to a whole session. Bundled; depends on `han-core`. - **[`han-core`](../han-core/README.md).** The shared foundation: the specialist agent roster the other plugins - dispatch, the project-discovery skill, the canonical rule files, and the `/pairing` working mode that builds any kind + dispatch, the `/load-han-config` skill every other skill invokes to read `.han/config.md` once per run, the + project-discovery skill, the canonical rule files, and the `/pairing` working mode that builds any kind of work in reviewable pieces. Bundled; depends on no other Han plugin. - **[`han-documentation`](../han-documentation/README.md).** The documentation layer: feature and system docs, architectural decision records, and runbooks. Bundled; depends on `han-communication` and `han-core`. @@ -50,19 +51,19 @@ description of what it does. The `han` meta-plugin is a convenience wrapper that publishing work items as issues through the `gh` CLI. Bundled; depends on `han-communication`, `han-core`, and `han-coding`. - **[`han-reporting`](../han-reporting/README.md).** The reporting layer: turning a spec into a plain-language - stakeholder summary and a shareable HTML report. Bundled; depends on `han-communication`. + stakeholder summary and a shareable HTML report. Bundled; depends on `han-communication` and `han-core`. - **[`han-feedback`](../han-feedback/README.md).** The opt-in feedback layer: structured post-session feedback on the - Han skills you ran. Opt-in; depends on no other Han plugin. + Han skills you ran. Opt-in; depends on `han-core`. - **[`han-atlassian`](../han-atlassian/README.md).** The opt-in Atlassian layer: publishing Han artifacts to Confluence and creating work items in Jira. Opt-in; depends on `han-communication`, `han-core`, `han-documentation`, `han-planning`, and `han-coding`; requires an Atlassian MCP server. - **[`han-linear`](../han-linear/README.md).** The opt-in Linear layer: creating one Linear issue per work-item slice. - Opt-in; depends on no other Han plugin; requires a Linear MCP server. + Opt-in; depends on `han-core`; requires a Linear MCP server. - **[`han-ddd`](../han-ddd/README.md).** The opt-in Domain-Driven Design layer: discovering bounded context candidates and producing an evidence-backed domain and context map for an existing codebase. Opt-in; depends on `han-communication` and `han-core`. - **[`han-plugin-builder`](../han-plugin-builder/README.md).** The opt-in plugin-building layer: the authoring guidance - and two interview-driven builders for new skills and agents. Opt-in; depends on nothing. + and two interview-driven builders for new skills and agents. Opt-in; depends on `han-core`. - **[`han`](../han/README.md).** The meta-plugin with no components of its own. It bundles `han-communication`, `han-core`, `han-documentation`, `han-research`, `han-planning`, `han-coding`, `han-github`, and `han-reporting`. Installing it is how you ask for the bundled suite in one command. It does not bundle `han-feedback`, `han-atlassian`, @@ -79,9 +80,9 @@ their skills dispatch the shared specialist agents that live there, and on `han- produce prose and source the readability standard from it. When you install a plugin that declares a dependency, Claude Code resolves and installs the dependency for you automatically and tells you what it added. So installing any of them installs both alongside it, and you get the shared agent roster, project discovery, the pairing working mode, and the -readability standard either way. (`han-reporting` is the exception: it depends on `han-communication` alone.) +readability standard either way. -That means **every layer install except `han-reporting` comes with the shared agents.** The real choice comes down to: +That means **every layer install comes with the shared agents.** The real choice comes down to: - **A layer plus the foundations** (for example `han-documentation` or `han-coding`): that layer's skills, plus the shared agent roster, project discovery, and the pairing working mode from `han-core`, and the readability standard diff --git a/docs/concepts.md b/docs/concepts.md index b24c42dc..3b5f7ebc 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -237,7 +237,8 @@ Direct invocation uses the `Agent` tool with `subagent_type: {plugin}:{agent-nam ## How Han is packaged Han ships as a family of plugins in one marketplace. `han-core` carries the shared specialist agent roster the other -plugins dispatch, the project-discovery skill, the `/pairing` collaborative working mode, and the canonical rule files. +plugins dispatch, the `/load-han-config` skill every other skill invokes to read `.han/config.md` once per run, the +project-discovery skill, the `/pairing` collaborative working mode, and the canonical rule files. `han-documentation` adds the documentation skills (`/project-documentation`, `/architectural-decision-record`, and `/runbook`). `han-research` adds the pre-planning knowledge-work skills (`/research`, `/gap-analysis`, and @@ -246,26 +247,25 @@ implementation (`/plan-a-feature`, `/plan-a-change`, `/plan-implementation`, `/p `/plan-work-items`, `/iterative-plan-review`, and `/reassess-approach`). `han-coding` adds the coding skills you reach for while working in code (`/tdd`, `/refactor`, `/restructure`, `/design-an-api`, `/code-review`, `/code-overview`, `/code-walkthrough`, `/architectural-analysis`, `/automated-test-planning`, `/manual-test-planning`, `/investigate`, and `/coding-standard`). `han-github` adds the GitHub skills, and `han-reporting` adds the reporting -skills. All of these except `han-reporting` depend on `han-core`, so installing any of them brings the shared agents -along; `han-reporting` depends only on `han-communication`. +skills. All of them depend on `han-core`, so installing any of them brings the shared agents along. `han` is a meta-plugin with no components of its own. It depends on `han-communication`, `han-core`, `han-documentation`, `han-research`, `han-planning`, `han-coding`, `han-github`, and `han-reporting`, so installing it pulls in the bundled suite. -The remaining plugins are opt-in. `han-feedback` adds the post-session feedback skill and depends on no other Han -plugin. `han-atlassian` adds the Confluence and Jira skills; it needs a configured Atlassian MCP server, and because its +The remaining plugins are opt-in. `han-feedback` adds the post-session feedback skill and depends on `han-core` for the shared configuration loader. `han-atlassian` adds the Confluence and Jira skills; it needs a configured Atlassian MCP server, and because its wrapper skills run skills from `han-documentation`, `han-planning`, and `han-coding`, it depends on those three plus -`han-core`. `han-linear` adds the work-items-to-Linear skill, needs a configured Linear MCP server, and depends on no -other Han plugin. `han-ddd` adds the `/ddd-analysis` skill and the Domain-Driven Design agents it dispatches, and depends +`han-core`. `han-linear` adds the work-items-to-Linear skill, needs a configured Linear MCP server, and depends on +`han-core` for the shared configuration loader. `han-ddd` adds the `/ddd-analysis` skill and the Domain-Driven Design agents it dispatches, and depends on `han-communication` and `han-core`. The `han` meta-plugin does not pull these in, so you install each on its own. `han-plugin-builder` carries the guidance for building skills, agents, and plugins, plus the interview-driven -`/skill-builder` and `/agent-builder` skills. It depends on nothing and is also opt-in. +`/skill-builder` and `/agent-builder` skills. It depends on `han-core` for the shared configuration loader and is also opt-in. The practical choice is core only, the bundled suite, or the suite plus whichever opt-in plugins you want. There is no planning-only, coding-only, or GitHub-only install. Reporting-only is possible: installing `han-reporting` gives you -`/stakeholder-summary` and `/html-summary` plus `han-communication`, without the `han-core` agent roster. +`/stakeholder-summary` and `/html-summary` plus `han-communication` and `han-core`, which every Han plugin depends on +for the shared configuration loader. For which one to install and the dependency that surprises people, read [Choosing a Han plugin](./choosing-a-han-plugin.md). diff --git a/docs/configuration.md b/docs/configuration.md index 1dad03c2..206acecf 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -5,8 +5,10 @@ Claude Code configuration directory carries settings that follow you into every `.han/config.md` adjusts those settings for that project. Both control where skills write their markdown deliverables, which extra agents dispatching skills consider, the default swarm size the sizing-aware skills start at, the writing-voice profile the readability skills apply, and the review types and attached agents `/code-review` adds to -what Han ships. Every Han skill reads both files on every run, so the overrides take -effect without depending on the model remembering to look. Someone with neither file sees no change of any kind. +what Han ships. Every Han skill reads both files on every run through one shared +loader, `han-core:load-han-config`, so the overrides take effect without depending on the model remembering to look, +and a skill that another skill invokes uses what the first one loaded instead of reading them again. Someone with +neither file sees no change of any kind. > See also: [Plugin landing page](../README.md) · [Concepts](./concepts.md) · [Quickstart](./quickstart.md) · > [All skills](./skills/README.md) · [All agents](./agents/README.md) @@ -30,7 +32,8 @@ effect without depending on the model remembering to look. Someone with neither ignored and which file it came from. A missing or empty file changes nothing and says nothing. - **The interpretation contract lives in [`han-core/references/config-rule.md`](../han-core/references/config-rule.md).** Every skill applies that one rule - file (vendored byte-identical into each plugin), so one pair of files resolves identically across the whole suite. + file, which `han-core:load-han-config` prints into each run's context, so one pair of files resolves identically + across the whole suite. This page is the operator-facing guide. ## Where each file goes diff --git a/docs/how-to/create-a-new-agent.md b/docs/how-to/create-a-new-agent.md index 2c74d681..fbcf1d3a 100644 --- a/docs/how-to/create-a-new-agent.md +++ b/docs/how-to/create-a-new-agent.md @@ -139,7 +139,7 @@ place you can stop and look at what you have. - **YAGNI applies to the artifact.** Vocabulary terms, anti-patterns, tools, and frontmatter fields each have to earn their place against the agent's actual job. Anything added "for completeness" is cut during the review pass, which keeps the always-loaded description lean. See [YAGNI](../yagni.md) for the rule the discipline derives from. -- **No agents are dispatched to build yours.** `han-plugin-builder` depends on nothing and ships no agents, so the +- **No agents are dispatched to build yours.** `han-plugin-builder` depends only on `han-core` and ships no agents, so the review is done inline by reading the guidance, not by a review team. ## Where to go next diff --git a/docs/how-to/create-a-new-skill.md b/docs/how-to/create-a-new-skill.md index addf59bf..be202644 100644 --- a/docs/how-to/create-a-new-skill.md +++ b/docs/how-to/create-a-new-skill.md @@ -133,7 +133,7 @@ look at what you have. - **YAGNI applies to the artifact.** Every step, reference file, tool permission, and frontmatter field has to earn its place against a real use case. Anything added "for completeness" or "for future flexibility" is cut during the review pass. See [YAGNI](../yagni.md) for the rule the discipline derives from. -- **No agents are dispatched.** `han-plugin-builder` depends on nothing and ships no agents, so the review is done +- **No agents are dispatched.** `han-plugin-builder` depends only on `han-core` and ships no agents, so the review is done inline by reading the guidance, not by a review team. Cost is dominated by the interview length and the just-in-time reads of the governing documents, not by a swarm. diff --git a/docs/how-to/extend-han-with-plugin-dependencies.md b/docs/how-to/extend-han-with-plugin-dependencies.md index dfc68368..18cb89f6 100644 --- a/docs/how-to/extend-han-with-plugin-dependencies.md +++ b/docs/how-to/extend-han-with-plugin-dependencies.md @@ -162,9 +162,9 @@ The plugins are all listed in one `marketplace.json`, each with a relative `sour Notice the topology that falls out of this: `han` depends on `han-core`, `han-documentation`, and `han-github`; `han-documentation`, `han-github`, and `han-atlassian` all depend on `han-core`; `han-core` depends on nothing in this -example. The graph is acyclic, with the base layer at the bottom. (In the full suite, `han-core` and the foundational -`han-communication` plugin are two independent base layers — neither depends on the other, and `han-communication` owns -the shared readability standard — and every prose-producing plugin declares a direct dependency on it. The real +example. The graph is acyclic, with the base layer at the bottom. (In the full suite, `han-core` is the base layer every other plugin depends on, because its `load-han-config` skill +is the one place a run reads `.han/config.md`; the foundational `han-communication` plugin sits on it, owns the shared +readability standard, and every prose-producing plugin declares a direct dependency on it as well. The real `han-atlassian` also depends on `han-documentation`, `han-planning`, and `han-coding` because its wrappers run skills from each; the example trims that to the single edge that shows the shape.) diff --git a/docs/how-to/provide-feedback.md b/docs/how-to/provide-feedback.md index e6b5a470..696b43a7 100644 --- a/docs/how-to/provide-feedback.md +++ b/docs/how-to/provide-feedback.md @@ -87,7 +87,7 @@ It ships in a separate plugin you install once. > `/plugin install han-feedback@han` - It depends on no other Han plugin, so it installs on its own. You only do this once; after + It depends on `han-core` for the shared configuration loader, which installs alongside it. You only do this once; after that the skill is available in every session. See [Choosing a Han plugin](../choosing-a-han-plugin.md) for where it sits in the suite. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/.discovery-notes.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/.discovery-notes.md new file mode 100644 index 00000000..9d664a46 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/.discovery-notes.md @@ -0,0 +1,161 @@ +# Discovery notes: issue #203, consolidate config loading + +Written by `plan-implementation` Step 2 on 2026-10-23 against `main` at `abba73a` (fetched; main is in sync with +origin). Specialists: read this first and do not re-grep for what is here. + +## Tech stack + +Markdown skill, agent, and doc content plus Bash scripts. No build. `npm test` runs Bats over every `*.bats` file; +`npm run lint` runs prek (Prettier, ShellCheck, hygiene). Plugins: 13 `han-*` directories plus the `han` meta-plugin. +Every `han-*` plugin ships a Claude manifest (`.claude-plugin/plugin.json`) and a Codex manifest +(`.codex-plugin/plugin.json`); `test/codex-packaging.bats` guards both. Versions follow `docs/semantic-versioning.md` +(adding a skill = minor bump; fixing a probe or allowed-tools = patch; one bump per branch, recalculated from baseline). + +## The work item's figures, measured + +``` +Measurement: "44 of 47 skills carry the probe" | find . -name SKILL.md (excluding node_modules, docs/, .claude/) | 45 shipped SKILL.md; 45 carry the probe +Measurement: "45 carry the instruction block" | grep -l "As your first action, use the Read tool" | 45 (all shipped skills) +Measurement: "That block is 65 words" | awk block in plan-a-feature/SKILL.md | wc -w | 65 +Measurement: "about 2,900 words" | 65 x 45 | 2,925 +Measurement: block identical everywhere? | md5 of the block with reference paths normalized | one hash across all 45 +Measurement: "readability-guidance (24 callers)" | grep -l han-communication:readability-guidance | 25 (includes readability-guidance's own SKILL.md and explanation-guidance's cross-reference; 23 distinct consuming skills by qualified-name mention) +Measurement: "explanation-guidance (8)" | grep -l han-communication:explanation-guidance | 9 (includes the two guidance skills' own files) +Measurement: skills with `Skill` in allowed-tools | frontmatter grep | 6: han-atlassian x4 (code-overview-, investigate-, plan-a-feature-, project-documentation-to-confluence), han-core:pairing, han-github:post-code-review-to-pr +Measurement: config-rule.md copies | find -name config-rule.md | 13, all one md5 (byte-identical) +Measurement: han-config-dir.sh | cat | 4 lines: printf "${CLAUDE_CONFIG_DIR:-$HOME/.claude}" +Measurement: skills whose only Bash grant is the config script | frontmatter grep | 5: investigate, edit-for-readability, explanation-guidance, readability-guidance, html-summary +Measurement: PR #172 | GitHub API | open, mergeable=false (dirty), 61 files, head kadams54/pi@771905bc, base main; touches all 13 config-rule.md copies and ~45 SKILL.md probe lines +Measurement: PR #184 | GitHub API | merged 2026-08-19 +Measurement: issue #178 | GitHub API | closed +Measurement: commit 8c96157 | git show | exists, 2026-07-09, "OI-3 spike outcome — inline validated, forked disqualified"; spike arms 12 inline + 12 forked + 12 baseline + 10 adversarial = 46; 34 same-context Skill calls, 0 early exits +Measurement: troubleshooting.md:473 | sed -n 473p | "### Cause 1: Data-fetch sub-skill (forked or inline)" (citation correct) +Measurement: writing-effective-instructions.md:145 | sed | "### Rule: Prefer inline discovery over forked data-fetch sub-skills" (citation correct) +Measurement: skill-composition.md:121 | sed | "### The one exception: surfacing a shared standard inline" (citation correct) +Measurement: context-hygiene.md:104 quote "The attention cost is per-context, not per-file" | grep repo, installed cache, git log -S | NOT FOUND anywhere, ever. Line 104 is "### Rule: Position critical content at the edges, not the middle". Nearest real rules: line 36 "Every token must earn its place"; line 191 "loaded skill content persists under a compaction budget"; line 205 "Stale tokens compete for attention on equal footing". The issue's citation is wrong and must not be carried into the guidance edit. +Measurement: does a Skill-invoked sub-skill re-run its probes and re-inject the block? | invoked han-communication:explanation-guidance from inside this plan-implementation run | YES: its Project Context rendered both probes again ("personal config directory: /home/tami/.claude", "project .han/config.md: (Bash completed with no output)") and the 65-word block again. The issue's central mechanism claim is confirmed by direct observation. +Measurement: skills that are the target of another skill's Skill call | grep bodies | readability-guidance, explanation-guidance; Atlassian wrappers call plan-a-feature, project-documentation, code-overview, investigate, markdown-to-confluence; pairing calls tdd, refactor, design-an-api, iterative-plan-review, plan-implementation; post-code-review-to-pr calls code-review. So "five-skill problem" undercounts the chain targets (~13), though the fix shape is the same for all. +``` + +## The guidance the issue wants corrected (paths and what is there now) + +All under `han-plugin-builder/skills/guidance/references/skill-building-guidance/`: + +- `skill-composition.md`. Lines 92-119 "Data-fetch composition (avoid)": names "a config setting" as a disallowed + example; the failure account (lines 98-102) is explicitly `context: fork` + `api_retry`. Lines 121-149 "The one + exception": three properties (inline; whole standard not a few values; caller finishes), with an honest limit on + the evidence (api_retry never induced). Line 115 "Duplicate small discovery logic rather than sharing it". +- `troubleshooting.md` line 473 "Cause 1: Data-fetch sub-skill (forked or inline)" asserts "unreliable in both forms" + and gives the inline mechanism as "no structured return mechanism and must manually context-switch back". No + evidence item or trial is cited for the inline half. The fix text (line 480) says "Duplicate the handful of + discovery lines". Summary checklist item 8 (line 504) repeats it. +- `writing-effective-instructions.md` lines 145-185: fork-only rule; the failing pair was `read-project-config` + invoked from `code-review`'s Step 1; the "After" example is the inline probe block. +- `context-injection-commands.md` lines 140-215: the probe-must-not-read-outside-project rule, the measured table + of probe forms that abort (every `${...}` and every variable except bare `$HOME`), and the script rule. +- `context-hygiene.md`: no per-context rule exists (see measurement above). + +Vendored copies: `han-plugin-builder:guidance init` vendors these files into consumer repos' `.claude/skills/`; those +lag until `guidance update` runs (noted in the July investigation as V15). + +## The config contract and its consumers + +- `han-core/references/config-rule.md` (canonical, 151 lines) plus 12 byte-identical vendored copies. Its "two + probes and the personal read" section pins the mechanism per skill: directory probe, project-file probe, and a + Read-tool call as the skill's first action (a probe cannot prompt or degrade; the personal file is the one lookup + outside the project). +- `scripts/han-config-dir.sh` (repo root) symlinked as `han-*/scripts/han-config-dir.sh` in every plugin that carries a + config-consuming skill. `scripts/han-config-dir.bats` enforces: exact probe text, exact grant text, and that each + plugin can reach the script, over every SKILL.md carrying the probe. These tests will need to change with the sweep. +- `docs/configuration.md` says "Every Han skill reads both files on every run, so the overrides take effect without + depending on the model remembering to look." A one-line "if you have not already this run" instruction changes that + sentence's truth for chained skills (by design) and the doc must say so. +- `CONTRIBUTING.md` lines 181-182 ("Adding a skill" step 2) tell authors to copy the probe and grant from an existing + skill. Must change with the sweep. +- `han-communication/skills/readability-guidance/SKILL.md` Step 1 resolves `writing-voice` from "either + `.han/config.md` probe". It is the only consumer that resolves a value from the config inside an inline sub-skill; + every other consumer applies config-rule.md itself. +- Precedent for the inline shape: `readability-guidance` and `explanation-guidance` (both carry the probe block AND + are invoked inline, which is the double-load the issue describes). Precedent for machine-written skill-consumed + context: `han-core/skills/project-discovery`. +- Long-form doc convention for inline-guidance skills: `docs/templates/coverage-rule.md#the-inline-guidance-variant` + (TL;DR, Key concepts, When it is used ...). CONTRIBUTING step 3 points there. + +## Prior attempts on unmerged branches (direct precedent, never merged) + +- `origin/han-config-skill` (River Bailey, 2026-07-24, one commit): `docs/plans/han-config-skill/investigation.md`, + 700 lines, "validated plan" for a `han-config` skill in `han-core` with three modes (inline read invoked by all 39 + then-shipped skills in place of their probe block; show; set). It planned to loosen `skill-composition.md` from + refusal to watch-outs, retire the 11 vendored config-rule.md copies, and accept degraded behavior for the five + plugins without a han-core dependency. Its validation surfaced: V9 the `Skill`-in-allowed-tools rule is + contradicted by 8+ shipped skills (enforcement unknown); V10 rerouting creates an untested depth-2 nested Skill call + (caller -> readability-guidance -> han-config) and a duplicate read, mitigated by a "check whether config was already + surfaced this run" rule plus a manual spike; V11 five plugins (han-communication, han-feedback, han-linear, + han-plugin-builder, han-reporting) do not depend on han-core, so a han-core loader is unavailable to their 9 skills. + Copy saved at `$TMPDIR/han-config-skill-investigation.md` for this run only. +- `origin/research/plugin-config-discovery` (River Bailey, 2026-10-15/16, last commit "halfway planned + implementation, but likely going to throw all of this away"): `docs/research/cross-plugin-config-discovery.md` is + about plugin-to-plugin contributions (moving test-engineer), not `.han/config.md`. Relevant findings it carries: a + plugin cannot read a dependency plugin's files by path (`${CLAUDE_PLUGIN_ROOT}` is self-only); `dependencies` are + hard requirements; Codex has no dependency or plugin-to-plugin mechanism. +- Neither branch is cited by issue #203. The maintainer's comment on #203 says the inline-copy-everywhere version + "works" and they want a better long-term solution. + +## History of the per-skill block (the three rewrites the issue names) + +- e483783 2026-07-30 "read the personal config with the Read tool, not a load-time probe" (classifier block; plan at + `docs/plans/fix-personal-config-probe-classifier-block/`). +- 88ee5c7 2026-07-30 personal config beneath the project one (#164; plan at `docs/plans/user-level-han-config/`). +- 55bdb1d / 52abdf4 2026-08-18/19 shared script probe (#184; investigation at + `docs/plans/fix-config-probe-expansion-rejection/investigation.md`, which measured eleven probe forms and chose + the script; it recorded as a remaining risk that the command text repeats twice per skill, "84 places to land"). +- PR #172 (open, dirty) re-edits the probe form #184 removed. + +## Test and eval surfaces + +- Bats: `scripts/han-config-dir.bats` (above), `test/codex-packaging.bats`, `test/sanity.bats`. +- Skillwalker evals under `evals//tests.json` (added in #218, 2026-09-22): test types `skill-prompt` and + `skill-call`, fields `plugins`, `model` (opus/sonnet), `promptFile`, `scaffold`, `expect` with `result-contains`, + `result-does-not-contain`, `skill-call`. No runner is in `package.json` and CONTRIBUTING does not document how to + run them; `output/` and `analytics/` are gitignored. 14 eval folders exist; none covers readability-guidance or + a chain. Gap: whether an eval can assert on context contents or on completion tokens is not documented in-repo. +- The OI-3 spike harness (the precedent for the trial the issue asks for) lives at + `docs/plans/han-communication-plugin/artifacts/oi-3-spike/`: `OI-3-spike-report.md`, `harness-skills/` (8 + SKILL.md files: spike-probe, consumer x4 arms, guidance x3), `spike-trials/` (49 artifacts), `incident-data.md`. + Method: skills hot-loaded in `.claude/skills/`, each trial in a fresh subagent told only to run the skill, completion + judged from a machine-checkable token plus four carried facts in the artifact on disk. Limits recorded: api_retry + could not be induced; testers were one model (Opus 4.8). + +## ADRs and standards + +- ADRs: only `docs/adr/0001-project-configurable-default-swarm-size.md`. No ADR covers skill composition or the + config mechanism. +- Coding standards: `docs/coding-standards/` does not exist. CONTRIBUTING.md is the contributor standard; the + plugin-builder guidance files are the authoring standard; CLAUDE.md mandates `han-plugin-builder:skill-builder` for + any new skill. + +## Recent churn (90 days) + +Every shipped SKILL.md changed 6-19 times. Highest: plan-implementation 19, plan-a-feature 17, code-review 16. The +guidance dir and `scripts/` changed with #184 (Aug 18-19) and the 2026-09-09 feedback fixes. Any sweep lands on files +that move weekly, so a mechanical (scripted, grep-gated) sweep is safer than hand edits. + +## Gaps (searched for, not found) + +- No recorded evidence, in guidance, plans, research, or git history, of an inline data-fetch sub-skill failing. The + only recorded failure is `read-project-config` under `context: fork` plus `api_retry`. +- No in-repo documentation of how to run Skillwalker evals, or of an eval that asserts on in-context content. +- No test guards that `allowed-tools` lists `Skill` for callers, and no measurement of whether the loader enforces it. +- No statement anywhere of whether Codex runs context-injection probes or supports a skill invoking another skill. +- No hook ships in any Han plugin (a SessionStart hook was considered on the October research branch, never built). + +## Plugin dependency graph (measured after round 1, from every `.claude-plugin/plugin.json`) + +``` +Measurement: han-core dependencies | plugin.json | [] (depends on nothing; CLAUDE.md agrees) +Measurement: han-communication dependencies | plugin.json | [] +Measurement: plugins depending on han-core | 7: atlassian, coding, ddd, documentation, github, planning, research (35 skills incl. han-core's own 2) +Measurement: plugins depending on han-communication | 8: the same 7 plus han-reporting (38 skills incl. han-communication's own 3) +Measurement: plugins depending on neither | han-feedback (1 skill), han-linear (1), han-plugin-builder (3); plus han-core's own 2 skills cannot reach a han-communication loader = 7 skills +Measurement: han-plugin-builder's three skills are vendored into consumer repos by `guidance init` to run "with no dependency on this plugin being installed" (guidance/SKILL.md Initialization Mode), so they must stay self-contained regardless of placement +``` diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/.yagni-ledger.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/.yagni-ledger.md new file mode 100644 index 00000000..086ed9d4 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/.yagni-ledger.md @@ -0,0 +1,28 @@ +# YAGNI and scope ledger (Step 7.5 input to synthesis) + +Scope gate: nothing cut. Every committed item descends from issue #203's five proposal steps or is a necessity of one +(tests, docs, indexes, version bumps, process). The July branch's extra modes were never inherited by this plan. + +## Deferred (YAGNI) + +| Item | Failure | Resolution | Source | +| --- | --- | --- | --- | +| `show` and `set` modes on the loader | evidence test: #203 does not ask; no finding needs them | defer; reopen when a user request to view or edit config through Han is recorded | SA-2, July branch | +| Resolved-values output shape with a `HAN_CONFIG_RESOLVED` marker line | simpler-version test: raw content under existing labels satisfies the same need; interpretation is per skill | defer; reopen if a trial arm or a report shows a chained skill misapplying raw content | TE-4, SA-1 (R1 C4) | +| Retiring the 12 vendored config-rule.md copies | evidence test: #203 does not ask; 34 citations would break | defer; reopen at the next config-rule.md edit that forces a 13-copy re-sync, or when a copy drifts | SA-8 | +| Adding `han-core` or `han-communication` as a dependency of han-feedback, han-linear, han-plugin-builder, or han-core | simpler-version test: keeping the old block in 7 skills satisfies the finding with no dependency change | defer; reopen if one of the 7 becomes another skill's Skill-call target | SA-6, JD-1 | +| SessionStart hook or fallback Read path for the 7 old-block skills | evidence test: those skills have no duplication | defer; same trigger as above | SA deferred list | +| Scoped `Skill(han-communication:load-han-config)` permission rule | evidence test: no prompt observed yet | defer; reopen only if the INL-NOGRANT arm prompts and a blanket `Skill` grant is judged too broad | SA deferred list | +| API-layer `api_retry` fault injection | evidence test: no harness can inject it; spike precedent | defer; reopen if a user reports an inline early exit after shipping | TE S1 | +| A Skillwalker eval per rewired consumer (38) | simpler-version test: one Bats guard asserts the line verbatim | defer; reopen if a consumer ships a non-canonical line | TE S2 | +| Running the trial under Codex | evidence test: Codex skill-to-skill behavior undocumented | defer; reopen if Codex documents skill invocation from a skill | TE S3 | +| Re-running the OI-3 standard-case arms | evidence test: already measured (34/34) | defer; reopen if the harness model changes | TE S4 | +| Bats guards for `Skill` in every caller's allowed-tools, index completeness, and byte-identity of config-rule copies | evidence test: enforcement unknown; indexes are reviewed by hand per CLAUDE.md; copies have not drifted | defer; reopen on the INL-NOGRANT result, a missed index entry, or a drifted copy respectively | TE-6.6 to 6.8 | +| General widening of property 2 to "a few values" | named anti-pattern: for-future-flexibility | replace with the bounded wording that names the config loader as the second validated case | JD-12, SA-11 | + +## Kept after the simpler-version test + +- SONNET-WORST arm (N=6): model-specificity is a recorded spike limit (OI-3 report), so one smaller-model arm earns its place. +- INL-NOGRANT arm (N=4): settles C12 for one sed-able edit either way. +- BASE arm (N=6): isolates consumer flakiness, the spike's own method. +- A "block-then-line" chain variant (N=5): `pairing` keeps the old block and invokes skills that carry the line, so one arm must show the second skill skips. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/implementation-decision-log.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/implementation-decision-log.md new file mode 100644 index 00000000..45933793 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/implementation-decision-log.md @@ -0,0 +1,680 @@ +# Implementation Decision Log: Consolidate config loading (issue #203) + + + +## Trivial decisions + +- D-19: Loader built through skill-builder with the inline-guidance doc variant. The loader is authored + with `/han-plugin-builder:skill-builder` per CLAUDE.md, gets a long-form doc under + `docs/templates/coverage-rule.md#the-inline-guidance-variant` (as `readability-guidance` has) at + `han-core/docs/skills/load-han-config.md`, a `han-core` README scent line, an entry in `docs/skills/README.md`, and a + mention in CLAUDE.md's `han-core` description and layout line. — Referenced in plan: Implementation Approach (What the loader surfaces), Definition of Done. +- D-20: Version bumps follow the one-bump-per-branch policy. `han-core` takes a minor for the new + skill. The five plugins gaining a `han-core` edge (`han-communication`, `han-feedback`, `han-linear`, + `han-plugin-builder`, `han-reporting`) each take at least a patch; for `han-plugin-builder` the same bump covers the + guidance edits. Every plugin whose files change in Phase D (all 13, through the config-rule re-sync) takes a patch. + Each bump is recalculated from its branch baseline and mirrored in `marketplace.json` per + `docs/semantic-versioning.md`. — Referenced in plan: Work Units and Sequencing, Definition of + Done. + +## Full decisions + +### D-1: Loader lives in han-core with five new dependency edges + +- **Question:** Which plugin hosts `load-han-config`, given that the issue's step 3 names `han-core` and the chain it + targets lives in `han-communication`? +- **Decision:** The loader is `han-core/skills/load-han-config/SKILL.md`, invoked as `han-core:load-han-config`, beside + `project-discovery` as the issue's step 3 says. The five plugins that do not declare `han-core` gain it as a direct + dependency (D-21), so every skill can reach the loader. This supersedes the earlier decision to place the loader in + `han-communication`, which stays below as a rejected alternative. +- **Rationale:** The user, who wrote issue #203, chose this after reading the plan: "let's put it into han-core and make + it a dependency of all other plugins so that we cover all skills. If maintainer declines, we can always refactor." + It matches the issue's step 3. It reaches the issue's chain (`plan-a-feature` to `readability-guidance` to + `explanation-guidance`) through the new `han-communication` edge, with no fallback sentence. It leaves no skill on the + old block, so one pattern holds for every skill, including new ones. +- **Evidence:** + - The user's direction, escalation register entry E1 in the iteration history. + - No cycle results: `han-core/skills` and `han-core/agents` hold zero references to `han-communication` (grep, + measured by the user), and `docs/plans/reduce-required-install-footprint/investigation.md` cut the edge from + `han-core` to `han-communication` for that reason. + - Plugin manifests (`.discovery-notes.md`, "Plugin dependency graph"): today 7 plugins (35 skills) depend on + `han-core`, and they exclude both guidance skills. 8 plugins (38 skills) depend on `han-communication`. + - JD-1, TE-7, SA-5, SA-6 all identify the reachability gap. The July branch recorded it as V11. +- **Rejected alternatives:** + - `han-communication`, the prior D-1 decision, now superseded — it reached the issue's chain with zero dependency + changes, because 8 plugins already depend on `han-communication`, and it needed no fallback sentence. Rejected + because 7 skills (`project-discovery`, `pairing`, `han-feedback`, `work-items-to-linear`, `agent-builder`, + `guidance`, `skill-builder`) could not reach it and would keep the old block, which leaves two patterns side by side + and 8 SKILL.md files on the resolver script, and because it departs from the issue's step 3. The prior record also + rejected adding a `han-core` dependency to `han-communication`, because CLAUDE.md states `han-communication` + "depends on nothing and every prose-producing plugin depends on it". That cost is now accepted and recorded in D-21. + This is the design that returns under the revisit criterion: line `han-communication:load-han-config`, 37 line + carriers, 7 old-block skills, 8 script references. + - `han-core` with no new edges and SA-5's fallback sentence in `readability-guidance` — rejected because the + fallback's trigger rests on the Skill tool's response to an uninstalled skill name, which is Unverified, and 10 + skills still could not reach the loader. + - Rewiring only the ~13 chain targets (JD-2) — rejected under D-6; it does not decide placement on its own. +- **Specialist owner:** software-architect (placement); maintainer (accepts or declines the edges at review). +- **Revisit criterion:** the maintainer declines the dependency edges at review. The `han-communication` placement then + returns as recorded above. +- **Dissent (if any):** SA-6 rejected a new `han-core` dependency "at this altitude" and deferred it to + `system-architect`, who was not dispatched. Recorded under disagree-and-commit: the user made the call with the + no-cycle evidence, and the maintainer's review is the check. +- **Driven by rounds:** R1, R2, E1. +- **Dependent decisions:** D-5, D-6, D-9, D-10, D-11, D-14, D-18, D-19, D-20, D-21, D-22. +- **Referenced in plan:** Outcome, Implementation Approach (Where the loader lives), Work Units and Sequencing, Risks + and Assumptions, Recommendation. + +### D-2: Loader surfaces raw file content under the existing labels + +- **Question:** Does the loader emit raw file content or resolved values? +- **Decision:** The loader surfaces the `personal config directory` value, the `project .han/config.md` value, and the + personal file read with the Read tool, under labels byte-identical to today's block. It resolves nothing and emits no + note. Pinned form, the rendered caller context with a project file and no personal file: + + ```text + - personal config directory: /home/tami/.claude + - project .han/config.md: --- + output-directory: docs/han + --- + [Read /home/tami/.claude/.han/config.md -> file does not exist] + ``` + + Pinned frontmatter values: `name: load-han-config`; + `allowed-tools: Read, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh")`; no `context` key. The + description names `han-core:load-han-config` and "resolve configuration". The body follows SA-2's sketch as written; + its rule link resolves to the canonical `han-core/references/config-rule.md`. +- **Rationale:** Precedence levels 1, 4, 5, and 6 and the silent-ignore rule are per skill, so a loader can never finish + resolution. A resolved shape would split interpretation across two places. Identical labels let the skills that read + config by label (`readability-guidance`, `edit-for-readability`, `pairing`, `project-discovery`) work unchanged, + whether the loader or an old-block skill supplied the text. +- **Evidence:** SA-1 and SA-2; `config-rule.md` sections on precedence and on degradation and the one-line note; the + personal-read rationale ("a probe cannot prompt and cannot degrade") survives because the loader also uses Read. +- **Rejected alternatives:** + - Resolved values behind a `HAN_CONFIG_RESOLVED` marker line (TE-4, JD-5) — rejected because raw content under the + existing labels is the strictly simpler version that meets the same need. Deferred under YAGNI with a reopen trigger. +- **Specialist owner:** software-architect. +- **Revisit criterion:** a trial arm or a user report shows a chained skill misapplying raw content. +- **Dissent (if any):** TE-4 proposed the marker shape; resolved in R2 without re-dispatch because the rendered loader + body supplies the signal TE-4 needed (D-3). +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** D-3, D-12. +- **Referenced in plan:** Implementation Approach (What the loader surfaces), Deferred (YAGNI). + +### D-3: Rendered loader body is the already-loaded marker + +- **Question:** What lets a later skill in the chain see that config is already loaded this run? +- **Decision:** The loader's own rendered body in the caller's context: its H1 `# Load Han Configuration` and its + hand-back paragraph. No separate marker line. When the loader runs twice, the latest copy wins. Pinned hand-back + paragraph: + + > The `personal config directory` and `project .han/config.md` values above, and the personal file you just read, are + > this run's Han configuration. They replace any copy surfaced earlier in this context. Apply them per + > [config-rule.md](../../references/config-rule.md) at the point your own workflow uses a setting. Say nothing about + > the configuration here. RETURN to the skill that invoked you and continue with its next step. + +- **Rationale:** A probe cannot be conditional, so the skip must happen in the caller's line before the loader is + invoked, and the only signal the caller has is earlier text in context. The loader's body is already there; adding a + marker line adds a second form to keep in sync. Latest-wins makes a redundant load harmless, and a copy lost to + compaction makes the check fail and reload. +- **Evidence:** SA-2 ("Already resolved" reporting), SA-4; observed re-render of a sub-skill's block + (`.discovery-notes.md` Measurements). +- **Rejected alternatives:** + - A fixed `HAN_CONFIG_RESOLVED | personal=... | project=...` line (TE-4) — rejected because the rendered body already + serves as the marker; a second form is a contract with no extra consumer. + - A detection step inside the loader — rejected because the loader's probes inject at load, before any instruction + runs, so it cannot skip its own cost (SA-2). +- **Specialist owner:** software-architect; test-engineer verifies through the CHAIN, DEPTH-2, and BLOCK-THEN-LINE arms. +- **Revisit criterion:** the CHAIN or DEPTH-2 arm records more than one `.loads` line, or BLOCK-THEN-LINE records any. +- **Dissent (if any):** none beyond TE-4's original shape (see D-2). +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** D-4, D-12. +- **Referenced in plan:** Implementation Approach (How a chained skill knows the config is already loaded), Definition + of Done. + +### D-4: Definition of a run + +- **Question:** What does "this run" mean in the consumer line? +- **Decision:** `config-rule.md` carries this definition verbatim: "A run begins when the person invokes a skill and ends + when that skill finishes. Every skill it invokes is part of the same run. A skill the person invokes later in the same + session is a new run and loads again." It sits beside the latest-wins rule. +- **Rationale:** Without a definition, a second slash command in a long session could reuse a file the person edited in + between. With it, the second command reloads and the newer copy governs. +- **Evidence:** SA-4; JD-5's question about two `/plan-a-feature` runs with an edit between them. +- **Rejected alternatives:** + - Leave "this run" as prose (the issue's text) — rejected because a model has no rule to apply across slash commands. + - Define a run as the session — rejected because it reuses stale config after the person edits it (SA-4). +- **Specialist owner:** software-architect. +- **Revisit criterion:** a report of a chained skill reloading inside one run, or of a second invocation reusing stale + config. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** D-9. +- **Referenced in plan:** Implementation Approach (How a chained skill knows the config is already loaded). + +### D-5: The consumer line and where it sits + +- **Question:** What exact text does a consumer carry, and where? +- **Decision:** This line, verbatim, inside `## Project Context` where the 65-word paragraph sat, with the two config + probes and the script grant removed. Other probes stay above it. + + ```markdown + Resolve configuration with `han-core:load-han-config` if you have not already this run. + ``` + +- **Rationale:** The issue's own line, verbatim. One fixed location keeps the sweep and + the grep gate mechanical. The continuation instruction lives in the loader's hand-back, following + `readability-guidance`'s precedent, so the line adds none. +- **Evidence:** issue #203 proposal step 4; SA-3. +- **Rejected alternatives:** + - `han-communication:load-han-config`, the prior text — superseded with D-1; it returns if the maintainer declines + the dependency edges. + - SA-5's variant with a fallback sentence ("If that skill is not available, treat this run as having no + configuration") — rejected because after D-21 every plugin depends on `han-core`, so the loader is always reachable + in an installed plugin, and the sentence's trigger is Unverified. The vendored copies, the one case without the + loader, are handled by D-22. +- **Specialist owner:** software-architect. +- **Revisit criterion:** the DIRECT arm or the smoke eval shows the line does not lead a directly invoked skill to the + loader. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2, E1. +- **Dependent decisions:** D-7, D-11. +- **Referenced in plan:** Implementation Approach (The line each consumer carries). + +### D-6: Which skills carry the line + +- **Question:** Which of the 45 skills rewire, which keep the block, and which change otherwise? +- **Decision:** + - 44 skills carry the line: every shipped skill except `explanation-guidance`. + - `readability-guidance` Step 1 changes its source phrases to name the run's `project .han/config.md` value or + personal `.han/config.md`, and the run's `personal config directory` value. No fallback sentence. + - `explanation-guidance` deletes both probes, the paragraph, and its Bash grant, and carries no line. + - No skill keeps the old block. The `han-plugin-builder` skills that `guidance init` vendors carry the line too (D-22). +- **Rationale:** The issue's step 4 asks for each consuming skill. The measured sweep history (4 sweeps since July, one + missing `pairing`) is evidence for single-sourcing beyond the chain targets. After D-21 every plugin reaches + `han-core`, so no skill needs the block. `explanation-guidance` names no setting, so deleting its block is strictly + simpler than rewiring it. +- **Evidence:** SA-3, SA-5 (grep for every schema token in `explanation-guidance` returns 0), SA-9 (commits e483783, + 78dc4f8, e79299f, 55bdb1d, and 0e5f44f); `.discovery-notes.md` dependency graph; D-21. +- **Rejected alternatives:** + - 37 carry the line and 7 keep the old block, the prior D-6 under the `han-communication` placement — superseded with + D-1; it returns if the maintainer declines the dependency edges. + - Rewire only the ~13 chain targets (JD-2) — rejected because two patterns would live side by side with no rule for + which one a new skill gets, and the block's sweep history is measured friction beyond the chain. + - Accept degraded config for skills that cannot reach the loader (the July choice) — moot now that every plugin + reaches it; it was rejected because users who install those plugins alone would silently lose `output-directory` + and `writing-voice`. + - Rewire `explanation-guidance` with the line — rejected because it uses no setting. +- **Specialist owner:** software-architect. +- **Revisit criterion:** the maintainer declines the dependency edges (then the 7 keep the block), or a new skill is + added, which changes the count. +- **Dissent (if any):** JD-2 recommended chain targets only, citing the issue's "suite-wide duplication is not the + problem". Recorded under disagree-and-commit; the reason for the call is the sweep history above. +- **Driven by rounds:** R1, R2, E1. +- **Dependent decisions:** D-7, D-10, D-11, D-13, D-22. +- **Referenced in plan:** Implementation Approach (Which skills change). + +### D-7: Scripted and grep-gated sweep + +- **Question:** How do 44 SKILL.md edits land without missing a file? +- **Decision:** A script performs the swap with whitespace-normalized matching of the paragraph. `pairing` line 49 and + `project-discovery` line 112 get hand edits that point "the probe above" at the run's `personal config directory` + value from the loader, and `readability-guidance` Step 1 gets its source-phrase edits. The Bats count gate (D-11) must pass + before merge. +- **Rationale:** Every SKILL.md changed 6 to 19 times in 90 days, and a hand sweep has already missed a file. +- **Evidence:** SA-3 hazards (verified after R1: `ddd-analysis` wrapping, the two "probe above" lines); commit 0e5f44f; + `.discovery-notes.md` "Recent churn". +- **Rejected alternatives:** + - A hand sweep — rejected because commit 0e5f44f shows one missing `pairing` and taking it down. + - A line-based replace — rejected because it misses `ddd-analysis`'s wrapping. +- **Specialist owner:** test-engineer (gate); implementer (script). +- **Revisit criterion:** the gate passes while a skill still carries a partial block. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** D-11. +- **Referenced in plan:** Implementation Approach (Which skills change). + +### D-8: Skill grant decided by trial + +- **Question:** Must every line carrier list `Skill` in `allowed-tools`? +- **Decision:** The INL-NOGRANT arm (N=4, default permission mode) decides, with both branches pinned: + - It prompts: the sweep adds `Skill` to every line carrier, which also fixes the 2 `han-reporting` skills that call + `readability-guidance` without it today. + - It does not prompt: the `skill-composition.md` sentence under "Declare the Skill tool in `allowed-tools`" is + corrected to say the list pre-approves a tool rather than gating it, and no carrier changes. +- **Rationale:** 23 skills call `readability-guidance` and only 6 list `Skill`; the guidance says the call is not + permitted without it. Enforcement is unknown, and either branch is one mechanical edit. +- **Evidence:** SA-7, TE-3 item 4, JD-9, V9 from the July branch. +- **Rejected alternatives:** + - Add `Skill` everywhere now — rejected because it acts on an unmeasured rule. + - Leave it alone — rejected because the guidance and 23 skills already disagree. +- **Specialist owner:** test-engineer. +- **Revisit criterion:** Claude Code documents how `allowed-tools` treats `Skill`. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** none. +- **Referenced in plan:** Implementation Approach (The line each consumer carries), Risks and Assumptions. + +Unverified: could not inspect this planning run's permission mode when it invoked a sub-skill without a `Skill` grant, +because it is not recorded. + +### D-9: Edit config-rule once and keep all 13 copies + +- **Question:** How does the shared config rule change, and do the vendored copies retire? +- **Decision:** Edit the canonical `han-core/references/config-rule.md`, then re-sync the 12 copies byte for byte. + - Opening paragraph: skills find both files through `han-core:load-han-config`, invoked once per run. + - The section on the two probes and the personal read opens: "`han-core:load-han-config` carries the two probe lines + and directs one Read-tool call." The personal-read bullet says the loader reads the file with the Read + tool. The rationale sentence stays verbatim. + - One new paragraph: the run definition (D-4) and latest-wins. + - All 13 copies stay. +- **Rationale:** The rule pins the per-skill probes, which becomes false after the sweep. Retiring copies would break 27 + mid-body SKILL.md lines and 7 reference-file lines, and the issue does not ask for it. +- **Evidence:** SA-8 counts; `.discovery-notes.md` (13 copies, one checksum). +- **Rejected alternatives:** + - Retire the vendored copies (July branch) — rejected; 34 citation lines break. Deferred under YAGNI. + - Leave the rule unchanged — rejected because it would describe a mechanism 44 skills no longer use. + - Keep the clause for skills in plugins that do not depend on the loader's plugin (the prior wording) — dropped, + because after D-21 there are none. +- **Specialist owner:** software-architect. +- **Revisit criterion:** the next edit that forces a 13-copy re-sync, or a copy drifts. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** none. +- **Referenced in plan:** Implementation Approach (The shared config rule and the resolver script), Definition of Done. + +### D-10: Script stays and its symlinks narrow + +- **Question:** What happens to `scripts/han-config-dir.sh` and its 13 symlinks? +- **Decision:** The script stays unchanged. Only `han-core/scripts/han-config-dir.sh` stays, because the loader is the + only SKILL.md that still calls the script. The other 12 symlinks are removed. The Bats test "every plugin holding + such a skill can reach the resolver script" stays and now covers only `han-core`. CLAUDE.md's `scripts/` layout + comment and the symlink count in `test/codex-packaging.bats`'s header comment change with it (D-18). +- **Rationale:** The script remains the single place a lookup changes; after the sweep only the loader references it. +- **Evidence:** SA-9; D-6's skill set; `CLAUDE.md` line 84 and `test/codex-packaging.bats` line 18 (read during the R3 + revision) narrate the 13 symlinks. +- **Rejected alternatives:** + - Keep all 13 symlinks — rejected because 12 would point at a script no file in their plugin calls. + - The five-plugin set under the `han-communication` placement — superseded with D-1. + - SA-9's original set of six, which kept `han-reporting` — superseded earlier, when `han-reporting`'s 2 skills took + the line. +- **Specialist owner:** software-architect. +- **Revisit criterion:** a skill outside `han-core` needs the script again, or the maintainer declines the dependency + edges. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2, E1. +- **Dependent decisions:** D-11. +- **Referenced in plan:** Implementation Approach (The shared config rule and the resolver script). + +### D-11: Bats guards replace the probe checks + +- **Question:** What tests guard the sweep once the probe is no longer in every skill? +- **Decision:** `scripts/han-config-dir.bats` keeps its three script tests and the "plugin can reach the resolver" + test (now covering only `han-core`), narrows its exact probe and grant checks to the loader, and adds a count gate: + + | Assertion | Expected | + | -------------------------------------------------------------------------------------------- | -------- | + | SKILL.md files carrying the consumer line verbatim, exactly once each | 44 | + | SKILL.md files carrying the 65-word paragraph, whitespace normalized | 0 | + | SKILL.md files referencing `han-config-dir.sh` | 1 | + | `explanation-guidance` carries the line, the paragraph, or the script | 0 | + | Line carriers outside `han-core` whose manifest omits it from `dependencies` (every plugin) | 0 | + | Loader frontmatter containing `context: fork` | 0 | + +- **Rationale:** Today's tests assert the probe in every skill and would fail after the sweep. The counts are the only + thing that catches a missed or half-swept file. The dependency check now covers every plugin, so it also catches a + dropped D-21 edge. +- **Evidence:** TE-6 items 1 to 5; SA-10 gate; counts derived from D-6 (44 + `explanation-guidance` = 45; the loader is + the one script reference). +- **Rejected alternatives:** + - SA-10's counts (36 / 8 / 9), the brief's 38, and the prior 37 / 7 / 8 under the `han-communication` placement — + superseded; the last returns if the maintainer declines the dependency edges. + - A Bats check that the false `context-hygiene.md` quote is absent (TE-9) — rejected; the simpler version is a review + check in work unit 1. + - Grant, index, and byte-identity guards (TE-6.6 to 6.8) — deferred under YAGNI. +- **Specialist owner:** test-engineer. +- **Revisit criterion:** a skill is added or removed, which changes the counts. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2, E1. +- **Dependent decisions:** none. +- **Referenced in plan:** Implementation Approach (The guards that replace the probe checks), Definition of Done. + +### D-12: Trial harness, arms, and pass criterion + +- **Question:** How is the issue's step 2 trial run, and what counts as holding? +- **Decision:** The OI-3 subagent harness, hot-loaded under `.claude/skills/`, artifacts under `artifacts/trial/`. + - Fixtures: `output-directory: trial-out-A`, `default-swarm-size: large`, `writing-voice: ./voice-fixture.md` with + sentinel `VOICE_SENTINEL_K7Q`, extra agents `han-core:code-reviewer` and `fake:ghost`; facts + `INC-4821 ERR_POOL_EXHAUSTED 8400ms checkout-api`. + - Completion token grammar: + `CONSUMER_COMPLETE | TRIAL_ID= | facts: <4 space-separated> | cfg: dir= swarm= voice= agents=` + - `.loads` line grammar, one appended line per loader execution: `LOADED | TRIAL_ID= | by=` + - Arms and N: BASE 6, INL 12, WORST 10, SONNET-WORST 6, CHAIN 12, BLOCK-THEN-LINE 5, DEPTH-2 6, DIRECT 6, INL-NOGRANT + 4, CFG-P/J/B/C/M/A 5 each, CFG-P-MISSING 5. About 102 trials. + - Pass: zero early exits and every carried fact and configured value present in every arm; CHAIN and DEPTH-2 hold + exactly one `.loads` line and BLOCK-THEN-LINE holds none. A SONNET-WORST failure alone narrows the guidance claim to + the larger model. INL-NOGRANT selects D-8's branch. + - No "loader absent" arm, since every installed plugin reaches the loader under D-1 and D-21. The one absent case, + a vendored builder copy, is checked by reading `init-guidance.sh` (D-22). +- **Rationale:** The spike measured the standard case; the values case is the gap the issue names. Matching the spike's + N lets results compare, and a side-effect file turns "did not reload" into something a checker can count. +- **Evidence:** TE-1, TE-2, TE-3, TE-7 (CFG-P-MISSING); SA-10 Phase B arms; YAGNI ledger ("Kept after the + simpler-version test"); `OI-3-spike-report.md` method. +- **Rejected alternatives:** + - Host the trial in Skillwalker evals — rejected under D-17. + - Re-run the spike's standard arms — deferred under YAGNI (already 34 of 34). + - A "loader absent" arm — dropped because D-1 and D-21 make the loader reachable from every installed plugin. +- **Specialist owner:** test-engineer. +- **Revisit criterion:** the harness model changes, or a user reports an inline early exit. +- **Dissent (if any):** none. DEPTH-2's N=6 is a synthesis choice matching DIRECT and BASE; test-engineer confirms it at + Phase B. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** D-8, D-13, D-14. +- **Referenced in plan:** Implementation Approach (The trial), Definition of Done. + +Unverified: could not inspect whether a subagent inherits a launcher-set `CLAUDE_CONFIG_DIR`, because the spike never +varied the environment and the repo does not document it. + +### D-13: What ships if the trial fails + +- **Question:** What ships if an arm other than SONNET-WORST fails? +- **Decision:** Phase A (the guidance correction) and the `explanation-guidance` block deletion ship. Nothing else does: + no loader, no dependency edges, no sweep, no widening. +- **Rationale:** The issue says step 1 "stands regardless", and `explanation-guidance` uses no setting, so its block is + dead weight whatever the trial shows. +- **Evidence:** issue #203 proposal; JD-7; SA-10 gate; SA-5. +- **Rejected alternatives:** + - Ship the loader anyway for chain targets only — rejected because the trial is the issue's condition for step 3. + - Ship nothing — rejected because the guidance contradicts its own spike regardless. +- **Specialist owner:** software-architect. +- **Revisit criterion:** a later trial passes after the failure's cause is fixed. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** none. +- **Referenced in plan:** Implementation Approach (The trial), Definition of Done. + +### D-14: Four phases with gates + +- **Question:** In what order does the work land? +- **Decision:** A: guidance correction with the pre-trial wording, no gate. B: trial; gate is D-12's pass criterion. C: + loader, its doc surfaces, the five `han-core` dependency edges and the surfaces that narrate them (D-21), guidance + widening, the `han-core` minor bump and the five patch bumps; safe alone because the loader is unused and the edges + only add an install. D: config-rule re-sync, scripted sweep, hand edits, Bats, docs, symlink removal, patch bumps; + gate is PR #172 no longer editing any SKILL.md. The edges must land before D, or the line in those five plugins + points at nothing. +- **Rationale:** Only Phase D touches the 45 files, so it goes last and alone; everything before it is small and + reversible. +- **Evidence:** SA-10 (whose Phase C already placed the loader and its minor bump in `han-core`), plus D-21. +- **Rejected alternatives:** + - One combined change — rejected because the trial must gate the loader, and the sweep must not race #172. + - Sweep before the loader lands — rejected because the line would point at nothing. + - Dependency edges in Phase D with the sweep — rejected because Phase D waits on #172 and the edges touch no + SKILL.md, so they need not wait, and the maintainer sees them earlier. +- **Specialist owner:** software-architect. +- **Revisit criterion:** the trial fails (D-13), or #172 resolves in a way that removes the Phase D gate. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2, E1. +- **Dependent decisions:** D-15. +- **Referenced in plan:** Work Units and Sequencing. + +### D-15: Sequencing with PR 172 + +- **Question:** How does this work sequence with PR #172? +- **Decision:** Recommend that #172 is rebased so its config half is the one-line change in `han-config-dir.sh` plus + the config-rule wording, with no SKILL.md edits, or that it is split so its Pi marketplace half lands alone. Phase D + waits until #172 edits no SKILL.md. The Pi marketplace entries stay out of scope. +- **Rationale:** Either recommended option frees #172 from the 45 files immediately, so Phases A to C run while it is + open. The only remaining overlap is the 13 config-rule copies, which Phase D re-syncs anyway. +- **Evidence:** SA-9 (the script line has been possible since #184); SA-10's three options; PR #172 is open and + conflicting, 61 files (`.discovery-notes.md`); the issue: "they should not run in parallel against the same 40-odd + files". +- **Rejected alternatives:** + - #203 first, holding #172 until Phase D merges — rejected as the recommendation because it keeps #172 open for four + phases. It stays available to the maintainer. +- **Specialist owner:** maintainer (sequencing call); software-architect (recommendation). +- **Revisit criterion:** the maintainer chooses otherwise (OI-3). +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** none. +- **Referenced in plan:** Work Units and Sequencing, Open Items. + +### D-16: Guidance corrections and bounded widening + +- **Question:** What do the guidance edits say, and how far does property 2 widen? +- **Decision:** SA-11, section by section. + - Phase A, `troubleshooting.md`: Cause 1 retitled to the forked case; forked sentence kept; inline sentence replaced + with the spike result and "a values-only inline sub-skill is untested"; checklist item 8 to match. + - Phase C, `skill-composition.md`: "Data-fetch composition (avoid)" narrowed to forked; the exception becomes + "surfacing shared content inline"; property 2 reads "It surfaces content many consumers would otherwise duplicate (a + whole standard, or a shared lookup's raw results) and leaves interpretation to the caller; fetching one value for + one skill is still inline discovery", naming the config loader as the second validated case; trial result beside the + spike; "Deciding which way to go" splits the "few values" bullet. Cause 1's last clause cites the trial. + - Phase C, `writing-effective-instructions.md`: closing paragraph says "forked data-fetch sub-skills" plus one + cross-reference to the exception. + - Phase D, `graceful-degradation.md` line 102 names the inline loader. + - `context-hygiene.md` is not edited. Citations use "Every token must earn its place" or "Treat stale context as a + bug, not tech debt", never the issue's nonexistent quote. + - Consumer repos lag until `guidance update`; noted, not pushed. +- **Rationale:** The guidance should state what the evidence shows: the failure account is fork-only and the inline case + was measured. One trial on one loader justifies naming one loader, not values in general. +- **Evidence:** `troubleshooting.md:473`, `writing-effective-instructions.md:145`, `skill-composition.md:121` (all + verified in `.discovery-notes.md`); commit 8c96157; the `context-hygiene.md` quote measured absent; JD-8, JD-12. +- **Rejected alternatives:** + - Widen property 2 to "a few values" in general — rejected as a for-future-flexibility anti-pattern; deferred under + YAGNI. + - Remove the inline half of Cause 1 outright — rejected because the values case is untested, not proven (JD-8). + - Carry the issue's `context-hygiene.md:104` quote — rejected because it does not exist. +- **Specialist owner:** maintainer (guidance author); software-architect. +- **Revisit criterion:** OI-1 surfaces inline-failure evidence, or a second values sub-skill is validated. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, R2. +- **Dependent decisions:** none. +- **Referenced in plan:** Implementation Approach (The guidance edits), Definition of Done, Deferred (YAGNI). + +### D-17: Skillwalker hosts a post-ship smoke eval only + +- **Question:** Can the trial run in the Skillwalker evals? +- **Decision:** No. The trial uses the subagent harness. Skillwalker hosts one post-ship smoke eval: a scaffold with a + project config, expecting a `skill-call` to `han-core:load-han-config` and `result-contains` the configured + band and its source file. +- **Rationale:** `tests.json` cannot express per-arm counts, a side-effect file, a token judged from a file on disk, a + rewritten worst-case loader, or a personal-directory override. The smoke eval exercises the shipped loader, which the + trial does not. +- **Evidence:** TE-5 (fields counted across `evals/*/tests.json`). +- **Rejected alternatives:** + - The trial in Skillwalker — rejected for the reasons above. + - One eval per consumer — deferred under YAGNI. +- **Specialist owner:** test-engineer. +- **Revisit criterion:** the runner gains file-system or environment assertions. +- **Dissent (if any):** none. +- **Driven by rounds:** R1. +- **Dependent decisions:** none. +- **Referenced in plan:** Implementation Approach (The trial), Work Units and Sequencing. + +Unverified: could not inspect the Skillwalker runner, because no runner is in `package.json` and `CONTRIBUTING.md` does +not document it. + +### D-18: Docs and contributor surfaces move with the sweep + +- **Question:** Which docs become false after the sweep? +- **Decision:** In Phase D: + - `CONTRIBUTING.md` "Adding a skill" step 2 tells authors to carry the consumer line in `## Project Context`. It + gives no block-copy instruction, because every plugin depends on `han-core` after D-21. + - `docs/configuration.md` line 7 gains the clause "a skill invoked by another skill uses what the first one loaded". + - `graceful-degradation.md` line 102 (under D-16). + - CLAUDE.md's `scripts/` layout comment (line 84), which says every plugin except `han` carries a resolver symlink, + and the "thirteen" symlink count in `test/codex-packaging.bats`'s header comment (line 18) follow D-10. + - The `guidance` long-form doc notes that vendored skills apply config only when `han-core` is installed (D-22). + - The dependency narration itself (CLAUDE.md, CONTRIBUTING.md, `docs/concepts.md`, `docs/choosing-a-han-plugin.md`, + READMEs, descriptions) moves earlier, in Phase C, with the edges (D-21). +- **Rationale:** Each describes the per-skill block, the symlinks, or the vendored skills as they were. +- **Evidence:** JD-11, SA-12, `docs/configuration.md:7`, `CONTRIBUTING.md:181-182` (verified on `main`); CLAUDE.md line + 84 and `test/codex-packaging.bats` line 18 (read during the R3 revision). +- **Rejected alternatives:** + - SA-12's pointer to `edit-for-readability` as the block to copy, and the later pointer to one of the 7 old-block + skills — both moot, because no skill keeps the block. + - Leave docs for a follow-up — rejected because `CONTRIBUTING.md` would tell authors to copy a probe the gate rejects. +- **Specialist owner:** implementer; maintainer reviews. +- **Revisit criterion:** a doc still describes the per-skill block after Phase D. +- **Dissent (if any):** none. +- **Driven by rounds:** R1, E1. +- **Dependent decisions:** none. +- **Referenced in plan:** Work Units and Sequencing, Definition of Done. + +### D-21: Five plugins gain a direct han-core dependency + +- **Question:** How does every skill reach a loader in `han-core`, and what do the new edges cost? +- **Decision:** `han-communication`, `han-feedback`, `han-linear`, `han-plugin-builder`, and `han-reporting` each add + `han-core` to `dependencies` in `.claude-plugin/plugin.json` as a direct edge. `.claude-plugin/marketplace.json` + mirrors it wherever an entry narrates dependencies. The surfaces that narrate those dependencies change in the same + unit: CLAUDE.md, CONTRIBUTING.md, `docs/concepts.md` (including line 266), `docs/choosing-a-han-plugin.md`, the five + plugin descriptions, and the five front-door READMEs. Codex manifests have no dependency field and do not change. The + edges land in Phase C, after the trial passes and before the sweep. +- **Rationale:** The line names `han-core:load-han-config`, so a skill whose plugin does not depend on `han-core` would + point at nothing. The suite declares every edge directly and no plugin relies on a transitive install, so each of + the five gets its own edge, and the count gate can check every plugin the same way. +- **Evidence:** + - The user's direction, E1. + - No cycle: zero references to `han-communication` in `han-core/skills` and `han-core/agents`; + `docs/plans/reduce-required-install-footprint/investigation.md`. + - Surfaces that narrate the old dependencies, measured: CLAUDE.md, CONTRIBUTING.md, `docs/concepts.md`, and + `docs/choosing-a-han-plugin.md` say `han-communication` depends on nothing; `docs/concepts.md` line 266 offers a + reporting-only install "without the `han-core` agent roster"; `han-communication/README.md:8`, + `han-feedback/README.md:8`, `han-linear/README.md:8`, `han-plugin-builder/README.md:9` ("does not pull `han-core` + along"), and `han-reporting/README.md:8` narrate each plugin's dependencies; the `han-communication` and + `han-linear` marketplace entries do too. +- **Costs, recorded:** + - `han-communication` stops being the plugin that depends on nothing. `han-core` becomes the only plugin with no + dependency, and the layering CLAUDE.md describes changes to match. + - A reporting-only install no longer avoids the `han-core` agent roster. + - `han-communication` is 196K; `han-core` is 896K with 22 agents. Installing any of the five now pulls in the roster. +- **Rejected alternatives:** + - No new edges, with the loader in `han-communication` — see D-1; it returns if the maintainer declines. + - One edge from `han-communication` to `han-core`, relying on transitive installs for the rest — rejected because the + suite declares every edge directly, and `han-feedback`, `han-linear`, and `han-plugin-builder` do not depend on + `han-communication`, so they would still need their own edge. +- **Specialist owner:** maintainer (accepts or declines at review); implementer. +- **Revisit criterion:** the maintainer declines the edges at review (RK-8), or a reference from `han-core` to + `han-communication` appears, which would make the edge a cycle. +- **Dissent (if any):** SA-6 deferred any new `han-core` edge to `system-architect`, who was not dispatched (see D-1). +- **Driven by rounds:** R3, E1. +- **Dependent decisions:** D-6, D-10, D-11, D-20, D-22. +- **Referenced in plan:** Implementation Approach (Where the loader lives), Work Units and Sequencing, Definition of + Done, Risks and Assumptions. + +### D-22: Vendored plugin-builder copies carry the line unchanged + +- **Question:** `guidance init` vendors `han-plugin-builder`'s skills into consumer repos to run with no plugin + installed. Do the vendored copies get the old probe block back, or carry the line? +- **Decision:** The vendored copies carry the line unchanged, and `init-guidance.sh` does not change. Where `han-core` is + installed, the line reaches the loader. Where it is not, the named skill is missing, which counts as no + configuration, and the run continues, per `config-rule.md`'s degradation rule that a bad config never fails a run. + The long-form `guidance` doc notes that config applies to vendored skills only when `han-core` is installed. Before + the sweep, the implementer reads `han-plugin-builder/skills/guidance/scripts/init-guidance.sh` to confirm it copies + the line through untouched. +- **Rationale:** It is the simpler option: no substitution logic and no second copy of the block to keep in sync. +- **Evidence:** `init-guidance.sh`, read during the R3 revision: it copies the `skill-builder` and `agent-builder` + directories verbatim, and `rewrite_skill` (lines 51 to 66) rewrites only the `plugin-` names, the + `${CLAUDE_PLUGIN_ROOT}/skills/guidance/references/` path, and `use guidance.`. The line contains none of those + strings. The vendored `guidance` comes from `assets/guidance-portable-SKILL.md`, which carries no config block, so + only `plugin-skill-builder` and `plugin-agent-builder` are affected. The script vendors neither `han-config-dir.sh` + nor `config-rule.md`, so today's vendored probe already falls back to `$HOME/.claude` for the personal directory, and + its `config-rule.md` link already does not resolve. +- **Cost, recorded:** today a vendored builder still reads the project `.han/config.md` through its `cat` probe. With the + line and no `han-core` installed, it reads no configuration. +- **Rejected alternatives:** + - `init-guidance.sh` substitutes the old probe block back into the vendored copies — rejected because it puts a second + copy of the probes, the grant, and the 65-word paragraph inside a sed script, to serve consumer repos that have not + installed `han-core`, with no report of one relying on config in a vendored builder. +- **Specialist owner:** implementer; maintainer reviews. +- **Revisit criterion:** a consumer repo reports a vendored builder skill ignoring its config, or the implementer's read + of `init-guidance.sh` shows it rewrites text the line contains. +- **Dissent (if any):** none. +- **Driven by rounds:** R3. +- **Dependent decisions:** none. +- **Referenced in plan:** Implementation Approach (Which skills change), Work Units and Sequencing, Definition of Done, + Deferred (YAGNI). + +Unverified: could not inspect the Skill tool's response to an uninstalled qualified skill name, because no session +without the target plugin installed was available. + +### D-23: The loader is one probe whose script prints both files and the rule + +- **Question:** After the trial, does the loader keep its two probes plus a Read-tool step, or become a single probe? +- **Decision:** A single probe. `han-core/skills/load-han-config/SKILL.md` is frontmatter plus one guarded probe line + that runs `scripts/load-han-config.sh` (symlinked as `han-core/scripts/load-han-config.sh`). The script resolves the + personal directory (`CLAUDE_CONFIG_DIR`, else `~/.claude`) and the working directory, prints whichever + `.han/config.md` exists under `# Load Han Configuration` with where each was found, the project file first, each + under its own `##` heading and between `===== BEGIN ... config =====` and `===== END ... config =====` marker lines, + then the config rule under `## How to apply them`, whose own sections are `###` so they nest, and closes with the + hand-back sentence; when neither exists it says so and names both paths tried. + Two lookups that name one file print it once as the project file. The old `han-config-dir.sh` is removed. + `config-rule.md` loses everything above `## Schema`, which described the probe mechanics rather than how to apply + a setting; the twelve copies are re-synced. +- **Rationale:** The user's own info skills load everything they need through one script probe and have run that way + in daily use, and the only reason the personal read was a model step was a classifier refusal of probe text that + named the path, which a script command does not. One probe leaves the caller nothing to do after the call. +- **Evidence:** user input (E2); the plumbing probes of this run, which loaded a repository-relative script probe in + every trial; `scripts/load-han-config.bats` (7 script tests, 7 skill guards). +- **Rejected alternatives:** + - Two probes plus a Read-tool step (D-2's shape, the one the trial ran) — superseded; it keeps a model step whose + only purpose was to dodge a probe-text refusal. + - Measure the single-probe form through the classifier before shipping it — declined by the user as unnecessary + given the info skills' track record. +- **Specialist owner:** software-architect. +- **Revisit criterion:** a load-time refusal of the script probe reported from any permission mode; the fallback would + be D-2's shape, whose evidence is the trial record. +- **Dissent (if any):** none. +- **Driven by rounds:** R5, E2. +- **Dependent decisions:** D-3 (the marker stays the printed H1), D-9, D-10, D-11. +- **Referenced in plan:** Implementation Approach (What the loader surfaces), Implementation Approach (The shared config rule and the resolver script). + +### D-24: The vendored config-rule.md copies are retired + +- **Question:** With the loader printing the rule into every run, do the twelve vendored copies still earn their place? +- **Decision:** No. The twelve copies are deleted, the 33 mid-body citations in 22 skill and reference files now read + "the config rule `han-core:load-han-config` surfaced" instead of linking a file, the byte-identity guard goes, and + the layout and configuration docs stop describing the copies. `han-core/references/config-rule.md` is the single + copy. +- **Rationale:** The copies existed because a skill cannot read a dependency plugin's files. The loader now puts the + rule in context for every skill, so the file links had no reader left; the deferral's reopen trigger (a config-rule + edit forcing a 13-copy re-sync) fired twice on this branch. +- **Evidence:** user input (E3); the citation grep recorded in R6; `scripts/load-han-config.bats`. +- **Rejected alternatives:** + - Symlink the copies to the canonical file — root-escaping symlinks are proven for Claude Code installs but not for + Codex, and the links had no remaining purpose either way. + - Keep the copies and the guard (the plan's deferral) — superseded by the trigger firing. +- **Specialist owner:** software-architect. +- **Revisit criterion:** a skill that must read the rule without invoking the loader. +- **Dissent (if any):** none. +- **Driven by rounds:** R6, E3. +- **Dependent decisions:** D-9 (its re-sync step is now moot). +- **Referenced in plan:** Implementation Approach (The shared config rule and the resolver script). + +### D-25: The loader script lives in han-core, not at the repo root + +- **Question:** With one plugin running the script, does it still need a repo-root home and a symlink? +- **Decision:** No. `han-core/scripts/load-han-config.sh` is a regular file with `load-han-config.bats` beside it, + the repo-root `scripts/` folder is gone, and the script reads the rule only from `../references/config-rule.md` + beside it; the repo-root fallback lookup is removed. +- **Rationale:** The symlink existed so twelve plugins could share one script; after D-10 and D-24 only han-core + runs it, and a symlink that reaches outside the plugin is one more thing an installer has to preserve. +- **Evidence:** user input (E4); `han-core/scripts/load-han-config.bats`. +- **Rejected alternatives:** + - Keep the repo-root script and symlink — nothing else uses it. +- **Specialist owner:** software-architect. +- **Revisit criterion:** a second plugin that must run the script without han-core installed. +- **Dissent (if any):** none. +- **Driven by rounds:** R7, E4. +- **Dependent decisions:** — +- **Referenced in plan:** Implementation Approach (The shared config rule and the resolver script). + diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/implementation-iteration-history.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/implementation-iteration-history.md new file mode 100644 index 00000000..47ce84ef --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/implementation-iteration-history.md @@ -0,0 +1,282 @@ +# Implementation Iteration History: Consolidate config loading (issue #203) + + + +## R1: Parallel specialist review + +- **Specialists engaged:** test-engineer (TE-1..TE-9, deferred S1..S4), software-architect (SA-1..SA-12), + junior-developer (JD-1..JD-12, OQ1..OQ8). +- **New input provided:** issue #203 verbatim (`../issue-203.md`), the maintainer's comment, `.discovery-notes.md` + (measurements, prior unmerged attempts on `origin/han-config-skill` and `origin/research/plugin-config-discovery`, + the OI-3 spike harness), and `scope-boundary.md`. No technical notes and no visual material exist for this work. +- **Claim ledger:** + + | # | Claim (merged by substance) | Identifiers | State | + | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | C1 | A Skill-invoked sub-skill re-renders its probes and the 65-word block, so a chain holds several copies. | discovery measurement, JD summary | Evidenced: observed in this run when `explanation-guidance` was invoked (`.discovery-notes.md` Measurements) | + | C2 | No recorded evidence of an inline data-fetch sub-skill failing; "both forms" has no citation. | JD-8, SA-11, discovery Gaps | Evidenced (absence verified across guidance, plans, research, and git history); the maintainer may hold unrecorded evidence (OQ-6) | + | C3 | The loader should surface raw file content under today's byte-identical labels, not resolved values. | SA-1 | Evidenced (config-rule.md precedence levels 1, 4, 5, 6 and the silent-ignore rule are per skill) | + | C4 | The loader should emit a fixed marker line (`HAN_CONFIG_RESOLVED \| personal=... \| project=...`) plus resolved value lines, so a chained skill can see it already ran. | TE-4, JD-5 | Disputed with C3 (two output shapes). See R2. | + | C5 | The two chain-target guidance skills live in `han-communication`, which does not depend on `han-core`, so a `han-core:load-han-config` is unreachable from exactly the chain the issue names. | JD-1, TE-7, SA-5, SA-6 | Evidenced (manifests); SA-5's fallback sentence relies on the Skill tool's response to an uninstalled skill name: Unverified, not reachable with granted tools | + | C6 | Rewire only the ~13 chain targets rather than all 45 skills. | JD-2 | Disputed with SA-3/SA-9 (35 rewired, 8 keep the block; the block has been swept 4 times since July and one sweep missed `pairing`, commit 0e5f44f). See R2. | + | C7 | "#172's config half becomes one line inside han-config-dir.sh" has been true since #184; it is not a benefit of consolidation. | JD-3, SA-9 | Evidenced (every probe already calls the script) | + | C8 | The issue's `context-hygiene.md:104` quote does not exist; figures 44/47, 24, 8, and "five-skill" are off (measured 45/45, 23, 7, ~13). | JD-4, SA-11 | Evidenced (discovery Measurements) | + | C9 | "If you have not already this run" is prose only: "run" needs a definition and a marker the model can see. | JD-5, SA-4, TE-4, TE-7 | Evidenced as a gap; SA-4 supplies the definition (a run begins at the person's invocation and includes every skill it invokes) and latest-wins | + | C10 | The trial has no pass criterion and no failure branch in the issue. | JD-7, TE-2, TE-3, SA-10 | Evidenced as a gap; TE-2 supplies arms, counts, and criteria; SA-10 supplies the gate (stop after Phase A on any failure) | + | C11 | `explanation-guidance` uses no config setting, so its block can be deleted outright. | SA-5 | Evidenced (grep for every schema token returns 0 in its body) | + | C12 | Whether `Skill` must be in `allowed-tools` is contradicted by 23 callers that omit it; enforcement is unknown. | JD-9, SA-7, TE-3 (INL-NOGRANT arm) | Anecdotal on enforcement; this run invoked a sub-skill from a caller without the grant and was not prompted, but the session's permission mode is unrecorded. Trial arm settles it. | + | C13 | Codex may not support Skill-to-skill calls or probes; rewired skills could lose config under Codex. | JD-9, SA-6, TE-3 | Unverified: not reachable with granted tools. Mitigating evidence: 23 consumers already depend on a Skill call to `readability-guidance` under Codex today, so no new exposure class. | + | C14 | The maintainer's July branch planned the same loader and raised V9, V10, V11; the issue does not cite it. | JD-10 | Evidenced (branch read); why it stopped is a maintainer question (OQ-8) | + | C15 | Definition of done must include: docs/configuration.md:7, CONTRIBUTING.md:181-182, han-config-dir.bats, config-rule.md (canonical + 12 copies), long-form doc + scent line + indexes, CLAUDE.md layout, skill-builder process, version bumps, guidance lag (V15), graceful-degradation.md:102. | JD-11, SA-8, SA-11, SA-12, TE-6 | Evidenced | + | C16 | Widening property 2 must stay bounded: name the config loader as the second validated case, not "values" in general. | JD-12, SA-11 | Evidenced; SA-11's wording ("content many consumers would otherwise duplicate ... leaves interpretation to the caller") is bounded | + | C17 | The trial needs the OI-3 subagent harness; Skillwalker evals can host only a post-ship smoke eval. | TE-5 | Evidenced (tests.json fields); Unverified: the Skillwalker runner itself could not be inspected (not in package.json) | + | C18 | Sweep hazards: `ddd-analysis` wraps the paragraph differently; `pairing:49` and `project-discovery:112` cite "the probe above"; 0e5f44f shows a hand sweep missing a file. | SA-3 | Evidenced (lines verified after the round) | + | C19 | All 13 config-rule.md copies stay; retiring them breaks 27 mid-body SKILL.md citations and 7 reference-file citations. | SA-8 | Evidenced (counts measured by SA) | + | C20 | Bats guards after the sweep: exact line once per consumer, old pieces absent from consumers, only the loader (plus old-block skills) carries probes/grant/Read sentence, loader has no `context: fork`. | TE-6, SA-10 | Evidenced | + +- **Open Questions raised:** + - OQ-1: Where does the loader live (`han-core` per the issue, or elsewhere), given C5? (JD OQ1, SA-6, TE-7) + - OQ-2: Loader output shape: raw content under today's labels (C3) or a marker plus resolved values (C4)? + - OQ-3: Sweep scope: 45 per the issue's step 4, chain targets only (C6), or 35 + keep (SA-6)? + - OQ-4: What marker and what definition of "run" make the one-line hint checkable (C9)? + - OQ-5: Trial pass criteria and the failure branch (C10). + - OQ-6 (maintainer): is there unrecorded inline-failure evidence behind "both forms", and who reported the original + failure, on which skill and version? (C2) + - OQ-7: `Skill` grant enforcement and Codex behavior (C12, C13). + - OQ-8 (maintainer): why did `origin/han-config-skill` stop? (C14) + - OQ-9 (maintainer): #172 sequencing preference (issue's own open question; SA-10 gives three options). +- **Spec-maturity tags:** all 20 claims `plan-level`. No `spec-level` findings, no T# notes exist. Gate did not trip. +- **Contract pinning:** N at round end. Unpinned: the loader output shape (OQ-2), the "already resolved" marker + (OQ-4). Pinned already: the consumer line (issue text, SA-3), the loader body (SA-2 sketch), the completion token + (TE-1), the Bats assertions (TE-6/SA-10 counts). +- **Resolution source:** see R2 for every OQ. +- **Decisions produced:** D-5, D-7, D-9, D-10, D-11, D-12, D-14, D-15, D-16, D-17, D-18, D-19, D-20 (proposed in the + R1 reports: SA-2 to SA-12, TE-1 to TE-6, JD-11, JD-12; each was later adjusted in R2 or at synthesis for the loader's + placement and the counts). +- **Changed in plan:** Implementation Approach (What the loader surfaces, The line each consumer carries, The shared + config rule and the resolver script, The trial, The guidance edits, The guards that replace the probe checks), Work + Units and Sequencing, Definition of Done, Testing Strategy, Risks and Assumptions, Deferred (YAGNI), Specialist + Handoffs for Implementation. +- **Next-step recommendation:** continue iterating. SA-6 named `system-architect` as a handoff for the dependency-graph + option and Codex; OQ-1 through OQ-5 and OQ-7 are plan-level and unresolved. + +## R2: Evidence resolution (no re-dispatch) + +- **Specialists engaged:** none dispatched. Every open question was tried against evidence first, per Step 6; none + needed a junior-developer reframing turn because the junior-developer's R1 report already supplied the plain-language + framing, and none needed the user. +- **New input provided:** the plugin dependency graph measured after R1 (`.discovery-notes.md`, last section) and the + line checks on SA-3's hazards. +- **Claim ledger (changes only):** + - C4 vs C3 resolved: the loader surfaces raw content under today's labels (C3). The marker TE-4 asked for already + exists without a new shape: the loader's own rendered body (its H1 and hand-back sentence) is in the caller's context + after the call, and the two probe labels are byte-identical to the old block's, so a chained skill sees either. A + resolved-values shape goes to Deferred (YAGNI) with TE-4's rationale as the reopen trigger. + - C5 resolved: the loader lives in `han-communication`. Measured: `han-core` and `han-communication` each depend on + nothing; 8 plugins (38 skills, including every chain target the issue and discovery name) depend on + `han-communication`; 7 depend on `han-core` (35 skills, excluding both guidance skills). Placing it in `han-core` + needs SA-5's unverified fallback sentence inside `readability-guidance`; placing it in `han-communication` needs no + fallback and no dependency change. This departs from the issue's step 3 wording ("add `load-han-config` to + `han-core`, beside `project-discovery`") on an implementation placement, with the issue's rationale (precedent for + machine-written context) weighed against reachability of the exact chain the issue describes. Recorded as a full + decision with a revisit criterion; surfaced in the closing summary for the user to overturn. Superseded in R3: the + user chose `han-core` plus five new dependency edges (E1). + - C6 resolved: rewire every skill that can reach the loader (38 reachable; 37 take the line, because + `explanation-guidance` drops its block under C11 and carries no line; count corrected at synthesis) and keep the + old block verbatim in the 7 that cannot + (`project-discovery`, `pairing`, `han-feedback`, `work-items-to-linear`, `agent-builder`, `guidance`, + `skill-builder`). The issue's step 4 asks for each consuming skill; SA-9's measured sweep history (4 sweeps, one + missed file) is the evidence for single-sourcing beyond the chain targets; JD-2's chain-targets-only option is the + recorded rejected alternative (it leaves two patterns side by side with no rule for new skills). The 7 keep the + block because `han-plugin-builder`'s skills are vendored standalone by `guidance init` and the other 4 cannot + reach `han-communication`. Superseded in R3: with the E1 edges, 44 skills carry the line and none keep the block. + - C9 resolved: "run" pinned in config-rule.md per SA-4; the marker is the loader's rendered body (above); latest wins. + - C10 resolved: TE-2's arms and criteria, SA-10's gate. Failure branch: Phase A (troubleshooting.md correction) and + the `explanation-guidance` block deletion (C11) ship regardless; nothing else does. + - C12: settled by the INL-NOGRANT trial arm in default permission mode (SA-7 pins both branches). + - C13: stays Unverified, disposition `not reachable with granted tools`; recorded as a non-blocking open item and a + maintainer question, with the no-new-exposure evidence. + - The `system-architect` handoff SA-6 named was retired by evidence rather than dispatched: with the loader in + `han-communication` no dependency edge changes, and the Codex concern is unverifiable from this repository by any + specialist. +- **Open Questions raised:** none new. Remaining for the user or maintainer: OQ-6, OQ-8, OQ-9 (non-blocking; the plan + carries them as open items with the recommended answers). +- **Spec-maturity tags:** all plan-level; gate not tripped. +- **Contract pinning:** Y. Loader output shape pinned to the rendered example in SA-1/SA-2; marker pinned to the + loader's H1 `# Load Han Configuration`; consumer line pinned verbatim; completion token pinned (TE-1); Bats assertions + pinned as counts (SA-10 gate, adjusted to 37 line carriers, 7 old-block skills, 8 script references; corrected at + synthesis from 38, since 37 + 7 + `explanation-guidance` = 45). +- **Resolution source:** OQ-1 evidence (manifests); OQ-2 evidence (config-rule.md precedence) ; OQ-3 evidence (issue + step 4 + sweep history); OQ-4 evidence (SA-4 + loader body); OQ-5 evidence (TE-2, SA-10); OQ-6 deferred to the + maintainer (non-blocking); OQ-7 trial arm (C12) and Unverified (C13); OQ-8 deferred to the maintainer + (non-blocking); OQ-9 deferred to the maintainer with SA-10's recommendation (non-blocking). Synthesis corrections, + resolution source `synthesis (Step 8 evidence)`: the line-carrier count (37, not 38); SA-12's `CONTRIBUTING.md` + pointer to `edit-for-readability` as the block to copy (it carries the line under D-6, so the doc points at one of + the 7 old-block skills); SA-9's symlink set (`han-reporting` loses its symlink under D-1); the DEPTH-2 arm's N=6 and + the `.loads` line grammar `LOADED | TRIAL_ID= | by=`, which no report pinned (test-engineer + confirms at Phase B). +- **Decisions produced:** D-1, D-2, D-3, D-4, D-6, D-8, D-13 (added); D-5, D-9, D-10, D-11, D-12, D-14, D-18, D-19 + (changed: plugin name, symlink set, counts, arms, phase contents, or doc wording moved to `han-communication`). + Revised in R3 after E1: D-1 rewritten (loader in `han-core`, the R2 placement kept as its rejected alternative); + D-21 and D-22 added; D-2, D-5, D-6, D-7, D-9, D-10, D-11, D-12, D-13, D-14, D-17, D-18, D-19, D-20 changed. +- **Changed in plan:** Outcome, User Stories, Constraints and Boundaries, Implementation Approach + (Where the loader lives, What the loader surfaces, How a chained skill knows the config is already loaded, The line + each consumer carries, Which skills change, The shared config rule and the resolver script, The trial, The guards + that replace the probe checks), Work Units and Sequencing, Definition of Done, Risks and Assumptions, Open Items, + Recommendation, Constraints and Boundaries, Testing Strategy, Deferred (YAGNI), Specialist Handoffs for + Implementation. +- **Revised in R3:** the last four sections in the list above were added by the R3 revision. In Deferred (YAGNI), the + entry "A new dependency edge for `han-core`, `han-feedback`, `han-linear`, or `han-plugin-builder`" was deleted, + because the edges are now being added. OI-5 was removed from Open Items, resolved by E1. +- **Next-step recommendation:** go to synthesis. + +## R3: User decision applied + +- **Specialists engaged:** none dispatched. The plan was revised in place after the user, who wrote issue #203, answered + the loader-placement question (E1). +- **New input provided:** the user's decision and its evidence: zero references to `han-communication` in + `han-core/skills` and `han-core/agents`, the install-footprint investigation that cut that edge, plugin sizes + (`han-communication` 196K, `han-core` 896K with 22 agents), and the doc surfaces that narrate the old dependencies. + Read during the revision: `init-guidance.sh`, the five front-door READMEs, CLAUDE.md line 84, and the header comment + of `test/codex-packaging.bats`. +- **Claim ledger (changes only):** + - C5 re-resolved: the loader lives in `han-core`, and the five plugins without a `han-core` edge gain one, so every + skill reaches it. The R2 resolution is kept as D-1's rejected alternative. + - C6 re-resolved: 44 skills carry the line, 0 keep the block. +- **Open Questions raised:** none new. OI-5 is resolved by E1. +- **Spec-maturity tags:** all plan-level; gate not tripped. +- **Contract pinning:** Y. The consumer line is re-pinned to `han-core:load-han-config`; the counts are re-pinned to + 44 / 0 / 1; the dependency check covers every plugin. +- **Resolution source:** user (E1) for placement and the edges; evidence (`init-guidance.sh` read) for D-22. +- **Decisions produced:** D-21, D-22 (added); D-1 (rewritten, superseded design kept as a rejected alternative); D-2, + D-5, D-6, D-7, D-9, D-10, D-11, D-12, D-13, D-14, D-17, D-18, D-19, D-20 (changed). +- **Changed in plan:** Outcome, Constraints and Boundaries, Implementation Approach (Where the loader lives, What the + loader surfaces, The line each consumer carries, Which skills change, The shared config rule and the resolver script, + The guards that replace the probe checks), Work Units and Sequencing, Definition of Done, Testing Strategy, Risks and + Assumptions, Deferred (YAGNI), Open Items, Specialist Handoffs for Implementation, Recommendation. +- **Change notes:** the opening paragraph above `## Outcome` was rewritten. Work Units gained unit 7 for the edges, and + the later units were renumbered 8 to 15. Risks and Assumptions changed RK-7's count to 44, added RK-8, and updated + A1. +- **Next-step recommendation:** ship as planned. The dependency edges are the item the maintainer may decline. + +## Unaudited evidence classes + +- The Skill tool's behavior when a caller omits `Skill` from `allowed-tools` in default permission mode, supporting + the `allowed-tools` decision. No specialist could run a live session; the trial's INL-NOGRANT arm measures it. +- Codex's support for context-injection probes and Skill-to-skill calls, supporting the Codex open item. No specialist + could inspect it, because nothing in the repository documents it and no Codex session was available. +- The Skill tool's response to an uninstalled qualified skill name, supporting D-22's "no configuration" outcome for a + vendored builder copy without `han-core`. No session without the target plugin installed was available. + +## Escalation register + +The planning run itself was autonomous: the confirmation turn was not taken, and every question was settled by evidence +or recorded as an open item with a recommended answer. One question was answered by the user after the plan was +written. + +- **E1: Loader placement** + - **Question:** Where does the loader live? The plan placed it in `han-communication` (OI-5), departing from the + issue's step 3, which names `han-core`. + - **Answer (the user, issue author):** "let's put it into han-core and make it a dependency of all other plugins so + that we cover all skills. If maintainer declines, we can always refactor." + - **Landed in:** D-1 and D-21; applied in R3. + +## R4: Implementation record + +- **Specialists engaged:** none; the plan was executed inline by the run that wrote it. +- **New input provided:** the trial result (`artifacts/trial/trial-report.md`): 99 same-context trials across 15 arms, + zero early exits, every configured value applied, loader invoked exactly as each arm expected; the no-`Skill`-grant + arm completed without a prompt or error in this session's auto permission mode (D-8 branch: no grant added). +- **Rulings taken during execution, each recorded in the ledger:** D-22 overruled, so `init-guidance.sh` strips the + loader line from vendored builder copies and they run with no configuration; the planned SONNET-WORST arm was not + run because the user directed every sub-agent to run on Opus, so model specificity stays unmeasured; the CFG-P fixture + left the personal file's relative output path ambiguous in the harness consumer, both readings were accepted for + that arm and later personal fixtures used an absolute path; the eval files committed in #218 are unformatted on + `main`, so `npm run lint` rewrites them on every run and they were kept out of this branch. +- **Decisions produced:** D-8 resolved to its no-grant branch; D-22 superseded by the ruling above. +- **Changed in plan:** — +- **Next-step recommendation:** review the branch; the maintainer's answer on the five dependency edges (D-21) decides + whether the superseded `han-communication` placement returns. + +## R5: Loader reduced to a single probe + +- **Specialists engaged:** none; applied inline on the user's direction. +- **New input provided:** the user's question why the personal file was a Read step while the project file was a + probe, and their vote (E2) for one probe whose script resolves both files, prints them with `config-rule.md`, or + says neither was found and lists the paths tried, plus trimming `config-rule.md` above `## Schema`. +- **Claim ledger (changes only):** the Read-step rationale in the old config-rule opening (a probe cannot prompt or + degrade) rested on the probe text naming the path; with the path inside a script and the probe guarded, the refusal + does not apply and the guard degrades a failed script to a sentinel. Recorded as D-23. +- **Decisions produced:** D-23 (new); D-2 superseded in its mechanism, its surfaced content unchanged; D-10 and D-11 + now name `load-han-config.sh` and `scripts/load-han-config.bats`. +- **Changed in plan:** Implementation Approach (What the loader surfaces), Implementation Approach (The shared config rule and the resolver script). +- **Next-step recommendation:** review the branch. + +### E2: Should the loader keep a Read-tool step for the personal file, or be one probe? + +- **Round:** R5 +- **Answer:** "replace the full skill body with a single call to the probe. The probe resolves two configs. If either + exists, it prints contents of config-rule.md and contents of configs. Otherwise, it says that when the skill was + loaded, no project or personal config was found (and lists tried paths). Additionally, I vote to trim everything + above ## Schema in config-rule"; and "han's call via `bash "${CLAUDE_PLUGIN_ROOT}/..."` works better than what's in + ai-provision". +- **Landed in:** D-23; `han-core/skills/load-han-config/SKILL.md`; `scripts/load-han-config.sh`; `config-rule.md`. + +## R6: Vendored rule copies retired + +- **Specialists engaged:** none; applied inline on the user's direction. +- **New input provided:** the user asked why the twelve copies were not symlinks; a grep found 33 citations in 22 + files outside `han-core`, all of them now served by the rule the loader prints, and seven copies cited by nothing. +- **Decisions produced:** D-24 (new); D-9's re-sync step is moot. +- **Changed in plan:** Implementation Approach (The shared config rule and the resolver script). +- **Next-step recommendation:** review the branch. + +### E3: Keep the twelve vendored config-rule.md copies, symlink them, or delete them? + +- **Round:** R6 +- **Answer:** "do it" (delete the copies and rewrite the citations, as recommended). +- **Landed in:** D-24. + +## R7: Loader script moved into han-core + +- **Specialists engaged:** none; applied inline on the user's direction. +- **New input provided:** the user noted that with the copies gone, the script no longer needs a repo-root home, a + symlink, or a fallback lookup for the rule. +- **Decisions produced:** D-25 (new). +- **Changed in plan:** Implementation Approach (The shared config rule and the resolver script). +- **Next-step recommendation:** review the branch. + +### E4: Keep the repo-root script and symlink, or move the script into han-core? + +- **Round:** R7 +- **Answer:** "we can stop symlinking the script and move it and its test to han-core, plus remove fallback rule + lookup." +- **Landed in:** D-25. + + +## R8: Second trial against the shipped loader + +- **Specialists engaged:** none; run inline on the user's direction. +- **New input provided:** the second trial result (`artifacts/trial2/trial-report.md`): 48 same-context trials across + 10 arms against `han-core:load-han-config` as shipped (single probe, installed from a local marketplace, reached by + its cross-plugin name), zero early exits, every configured value applied, every tester reporting the invocation + sequence its arm expected. This closes the first trial's stated gap, that the copy ran as a project skill. +- **Rulings taken during execution:** the shipped loader carries no `.loads` side-effect step, so the invocation + sequence was taken from each tester's self-report rather than a file; three plumbing runs made before the harness + skills were linked into the main checkout's `.claude/skills/` were discarded and not counted. +- **Decisions produced:** none; D-12's pass criterion applied unchanged. +- **Changed in plan:** — +- **Next-step recommendation:** open the pull request. + +### E5: Run a second trial against the shipped loader before opening the pull request? + +- **Round:** R8 +- **Answer:** "let's run a trial on opus, just to be safe." +- **Landed in:** `artifacts/trial2/`; the trial citations in `skill-composition.md`, `troubleshooting.md`, and + `han-core/docs/skills/load-han-config.md`. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-junior-developer.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-junior-developer.md new file mode 100644 index 00000000..f5a62f06 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-junior-developer.md @@ -0,0 +1,215 @@ +# Round 1: Junior-Developer Review of issue #203 (consolidate config loading) + +Scope: `issue-203.md` (issue body and maintainer comment), read against `.discovery-notes.md`, `scope-boundary.md`, +CLAUDE.md, `han-core/references/config-rule.md`, `skill-composition.md` lines 88-149, `troubleshooting.md` lines +470-505, the 13 `plugin.json` dependency lists, and `git log` on the block since #184. Nothing was changed. + +## Summary + +The diagnosis in the issue holds up. Direct observation confirms that a chained sub-skill re-renders the probes and the +block (`.discovery-notes.md` Measurements, line 36), and the "both forms" wording in `troubleshooting.md` has no +recorded evidence for its inline half. The fix the issue proposes needs more work before it can be planned. Its main +chain targets live in a plugin that cannot reach `han-core`. The 45-file sweep rests on a maintenance cost that #184 +already removed. The trial has no success or failure criterion. And neither the "if you have not already this run" +hint nor what the loader surfaces is pinned down. + +| Severity | Count | +| ---------------- | ----- | +| Blocks decision | 3 | +| Muddies artifact | 5 | +| Worth clarifying | 4 | +| Polish | 0 | + +Open Questions: 8. Specialist handoffs: 7 (software-architect on JD-1, JD-2, JD-6, JD-9; test-engineer on JD-5, JD-7, +JD-11). + +## Plain-language restatement + +Every skill tells the model "go read the two config files" when it starts. When one skill calls another, the model is +told this again and gets the config content again, two or three times in one conversation. The issue wants one shared +skill that does the reading, with every other skill pointing at it in one line and skipping it if it already ran. The +plugin-building guidance bans that kind of shared skill, so the issue first argues that the ban is broader than its +evidence, then proposes a trial, and only builds and wires in the loader if the trial passes. Written out this way, +it is two changes bundled together: (a) stop chained calls from re-loading the config, which touches about 13 skills, +and (b) move every skill onto a new loader, which touches 45. The issue argues for (a) and proposes (b). + +## Findings + +**JD-1: The main chain targets cannot call a `han-core` skill** (Blocks decision; Standards conflict) +- Location: `issue-203.md#proposal` step 3 ("add `load-han-config` to `han-core`"). Against CLAUDE.md, which says + `han-communication` "depends on nothing and every prose-producing plugin depends on it". +- Evidence: `han-communication/.claude-plugin/plugin.json` declares no dependencies. `readability-guidance` and + `explanation-guidance`, the two skills in the issue's flagship `plan-a-feature` example, live there. Ten of the 45 + skills are in plugins without `han-core` as a dependency: han-communication (3), han-feedback (1), han-linear (1), + han-plugin-builder (3), han-reporting (2). The July branch recorded the same issue as V11 (`.discovery-notes.md` + "Prior attempts"). +- Plain terms: as written, the fix cannot reach the exact double-load it was proposed for. The only ways around it are + to make the foundational plugin depend on `han-core` (which reverses the layering CLAUDE.md describes), to put the + loader somewhere else, or to leave those 10 skills on the old block. The issue doesn't pick one of these. +- Questions: OQ1. Specialist: software-architect (where the loader lives, and the dependency direction). +- Next step: decide where the loader lives before step 2, because the trial should exercise the real call path. + +**JD-2: The stated problem is about ~13 chain targets, but the proposal edits 45 skills** (Blocks decision; YAGNI +candidate, simpler version available) +- Location: `issue-203.md#the-duplication` ("five-skill problem rather than a 44-skill one") against + `#proposal` step 4 ("Cut each consuming skill's block"). +- Evidence: the issue itself says suite-wide duplication "is not the problem". Measured chain targets come to about 13 + (`.discovery-notes.md` line 37). The other argument for a full sweep, "each pass edits 40-odd files" + (`#the-cost-is-already-visible`), predates #184. `git log -G` shows that since 2026-08-20 the block was only copied + into new skills (f586d00, 4fef1ba), never rewritten, and `scripts/han-config-dir.sh` has had one commit. +- Plain terms: Option A rewires only the chain targets. It solves the stated problem, and it can be rolled back one + skill at a time. The cost is that two patterns live side by side, and authors need a rule for which one a new skill + gets. Option B rewires all 45. That gives one pattern, but it adds a `Skill` grant and a nested call to roughly 39 + skills nobody chains, lands on files that change weekly, and rolling it back is another 45-file sweep. The evidence + supports A. B needs evidence the issue doesn't cite. +- Questions: OQ2. Specialist: software-architect. Recommended resolution: replace with the simpler version (chain targets + only), and record the full sweep under Deferred (YAGNI). Reopen trigger: the block or probe needs a content change + again. + +**JD-3: The #172 benefit is already true today** (Muddies artifact; uncited claim) +- Location: `issue-203.md#the-cost-is-already-visible`: "Under a consolidated loader, #172's config half becomes one + line inside `han-config-dir.sh`." +- Plain terms: after #184 every probe calls the script, so adding `AGENT_CONFIG_DIR` is already a one-line change to the + script. Consolidation doesn't add this benefit. It just shouldn't be counted toward the 45-file sweep. +- Questions: Q1 (Answered: `.discovery-notes.md` line 26 and the probe text in `readability-guidance/SKILL.md:17`). +- Next step: drop this claim from the plan's justification, or restate it as "already achieved by #184". + +**JD-4: Citations to re-check before anything is quoted into guidance** (Worth clarifying; Evidence) +- `context-hygiene.md:104` and its quoted rule do not exist (`.discovery-notes.md` line 35). The argument that leans on + it ("These co-reside") needs a real citation. Line 205 "Stale tokens compete for attention" is the nearest candidate. +- These figures are off: "44 of 47" is 45 of 45; "24 callers" is 23 consuming skills; "(8)" is about 7; "five-skill" is + about 13. None of these changes the direction. The plan should still use the measured figures. +- `scope-boundary.md#stated-scope` quotes the issue as "contradicts its own spec". The issue says "spike" + (`issue-203.md#proposal`). A verbatim quote in the scope record is wrong. +- "Three copies" for `plan-a-feature` is Assumed. One re-render was observed, but not this exact three-skill chain. +- Next step: fix the scope-record quote, and use only the measured figures and verified line citations in any guidance + edit. + +**JD-5: How would a skill know whether it has already loaded the config "this run"?** (Muddies artifact; Hidden +assumption, unpinned contract) +- Location: `issue-203.md#proposal` step 4: "if you have not already this run. The idempotence hint keeps a chain + resolving once." +- The naive question: the only signal the model has is earlier text in its context, and nothing about it is reliable. + An empty project config renders as "(Bash completed with no output)" (`.discovery-notes.md` line 36), which looks the + same as a probe that never ran. "This run" has no definition when someone runs `/plan-a-feature` twice in one session + and edits `.han/config.md` in between. After compaction, the earlier load may be summarized away. +- What would convince a reader: a stated marker the loader prints (for example a fixed heading plus "no project config + found" instead of blank output), a rule for what counts as a run, and a trial arm showing a chained skill skips the + load when the marker is present and loads when it is absent. +- Questions: OQ3. Specialist: test-engineer (trial arms for skip and no-skip). + +**JD-6: What the loader surfaces is described only in prose** (Muddies artifact; contract between components) +- Location: `issue-203.md#proposal` steps 3-4. Against `config-rule.md#the-two-files-the-two-probes-and-the-personal-read`, + which pins the mechanism per skill. +- The issue leaves open: the exact one-line text and where it sits; whether the loader outputs raw file text (so each + caller still applies precedence) or resolved values; who resolves `writing-voice`, which `readability-guidance` does + itself today (`.discovery-notes.md` "The config contract"); and what a caller does if the loader degrades. The issue + calls this "the values case". If the loader surfaces raw files, it is closer to the existing "surface a standard" + exception, and that changes what step 2 needs to test. +- Questions: OQ4; the issue's own open question on the personal Read (`#open-questions`) is part of this. + Specialist: software-architect. Next step: pin the output shape with a worked example, per + `han-planning/references/contract-pinning-rule.md`. + +**JD-7: The trial gates steps 3-5, but "holds" is undefined and there is no failure branch** (Blocks decision; Scope and +definition of done) +- Location: `issue-203.md#proposal` steps 2-3 ("If it holds"). +- The issue doesn't say what happens if the trial fails. It only says step 1 "stands regardless". The OI-3 shape + measures early exits. It wouldn't measure whether the caller used the right resolved values, whether the skip hint + works (JD-5), or the depth-2 call (caller, then `readability-guidance`, then loader; V10 in the July branch). The OI-3 + limits carry over: `api_retry` couldn't be induced, and only one model was tested. Skillwalker evals have no + documented way to assert on what is in context (`.discovery-notes.md` "Gaps"). +- Smallest useful outcome on failure: step 1 reworded to "inline values case untested" (not "reliable"). Either keep + today's block, or have the chain targets alone skip their own Read when config is already in context, with no new + skill. The plan should name this branch up front. +- Questions: OQ5. Specialist: test-engineer (pass criteria, arms, which models, harness). + +**JD-8: What exactly does step 1's correction say?** (Worth clarifying) +- Location: `issue-203.md#proposal` step 1 against `troubleshooting.md` "Cause 1" and summary item 8. +- The issue concedes "untested, not known-broken" (`#what-the-evidence-shows`). The honest correction is "inline is + untested for values". It would be wrong to remove the inline half outright. The maintainer's comment says the + original failure report "came from a coworker". That may be where "both forms" came from, and it isn't in the repo. +- Questions: OQ6 (maintainer). Unverified: could not inspect the coworker's original report, because it is not recorded + in the repo or in git history. + +**JD-9: The `Skill` grant and Codex behavior are unaddressed** (Muddies artifact; Hidden assumption) +- Location: `issue-203.md#proposal` step 4. `skill-composition.md` line 88 says a caller "must list `Skill` in its + `allowed-tools`". Only 6 skills do today (`.discovery-notes.md` line 24). V9 found that this rule is contradicted in + practice and that enforcement is unknown. +- Every `han-*` plugin ships a Codex manifest, and there is no statement of whether Codex lets a skill invoke another + skill. If it doesn't, Codex users lose config entirely under a one-line block. +- Questions: OQ7. Specialist: software-architect. Unverified: could not inspect Codex's skill-invocation behavior, + because no in-repo source documents it and none was run. + +**JD-10: Prior attempts aren't cited** (Worth clarifying; Standards and prior art) +- `origin/han-config-skill` (2026-07-24) planned this same loader and raised V9, V10 and V11, which are JD-9, JD-5/JD-7 + and JD-1 here. `origin/research/plugin-config-discovery` found that a plugin can't read a dependency's files by path. + The issue cites neither (`.discovery-notes.md` "Prior attempts"). +- Questions: OQ8 (maintainer: why the July branch stopped). + +**JD-11: The definition of done leaves out the surfaces the change forces** (Muddies artifact; Scope) +- Not named in `#proposal`: the `docs/configuration.md` sentence "Every Han skill reads both files on every run"; + CONTRIBUTING.md "Adding a skill" step 2; `scripts/han-config-dir.bats` (exact-probe assertions); + `config-rule.md` "two probes" section and its 12 vendored copies; a long-form doc, scent line and index entry for the + new skill (CLAUDE.md "Indexes stay complete"); building it through `skill-builder` (CLAUDE.md); version bumps + (`docs/semantic-versioning.md`); guidance vendored into consumer repos, which lags until `guidance update` runs. +- There is no rollback story or post-ship owner. Specialist: test-engineer (what Bats/eval guards replace the + exact-probe test). + +**JD-12: "Widen property 2 to match the trial" has no bound** (Worth clarifying; YAGNI candidate, named anti-pattern +"for future flexibility") +- Location: `issue-203.md#proposal` step 5 against `skill-composition.md` "The one exception", property 2. +- One trial on one loader gives evidence for one loader. Widening to "values" in general would allow every future + data-fetch sub-skill on the strength of a single case. Recommended resolution: replace with a simpler version that + names the config loader as the second validated case and leaves the general rule alone. + +## Open Questions + +1. **OQ1:** Where does the loader live, given that `han-communication` depends on nothing? Affects JD-1, JD-2. + Resolve: software-architect, then the maintainer (layering is their call). +2. **OQ2:** Is the goal the chain duplication (about 13 skills) or one pattern for all 45? Affects JD-2, JD-11, JD-12. + Resolve: the issue author and the maintainer. +3. **OQ3:** What marker proves the config "already loaded this run", and what counts as a run? Affects JD-5, JD-7. + Resolve: software-architect drafts, test-engineer adds a trial arm. +4. **OQ4:** Does the loader surface raw file text or resolved values, and who applies `config-rule.md` precedence? + Affects JD-6, JD-7, JD-12. +5. **OQ5:** What pass and fail criteria does the trial use, and what ships if it fails? Affects JD-7. Resolve: + test-engineer. +6. **OQ6:** Maintainer: is there unrecorded inline-failure evidence behind "both forms"? Who reported the original + failure (the coworker), on which Claude Code version, and was that skill forked or inline? Affects JD-8. +7. **OQ7:** Does Codex run context-injection probes and skill-to-skill calls, and does missing `Skill` in + `allowed-tools` actually block a call? Affects JD-9. +8. **OQ8:** Maintainer: was `origin/han-config-skill` abandoned for a reason (V9 to V11, a decision, or time)? Affects + JD-1, JD-10. + +### Questions only the maintainer can answer (draft reply to "any specific questions?") + +- Where did "unreliable in both forms" in `troubleshooting.md` come from? Was anything ever seen failing inline, or did + the wording generalize from the fork case? (OQ6) +- The coworker's original report: which skill, which Claude Code version, forked or inline, and is the transcript still + available? (OQ6) +- Why did the July `han-config-skill` branch stop, and does anything in its V9 to V11 findings still worry you? (OQ8) +- Are you willing to have `han-communication` depend on `han-core`, or should it stay foundational with a loader + somewhere else? (OQ1) +- Is the goal to stop the chain double-load (about 13 skills), or to have one config pattern for every skill (45)? + (OQ2) +- How do you want this sequenced with #172: rebase #172 onto #184 first (now a one-line script change, JD-3), or hold + it? The issue says the two should not run in parallel (`#open-questions`). +- Do Han users run these skills under Codex today, so that a skill-to-skill call has to keep working there? (OQ7) + +## Protocol coverage + +- P1 Clarifying-question sweep: OQ1 to OQ8 plus Q1 (Answered, JD-3). +- P2 Hidden assumptions: JD-1, JD-5, JD-9. +- P3 Evidence: JD-3, JD-4, JD-8. +- P4 Standards: JD-1 (CLAUDE.md layering), JD-9 (`skill-composition.md` grant rule), JD-10, JD-11. There is no + `docs/coding-standards/` and no ADR on composition, so the plugin-builder guidance and CONTRIBUTING.md stand in. +- P5 Specialists: software-architect (JD-1, JD-2, JD-6, JD-9), test-engineer (JD-5, JD-7, JD-11). +- P6 Done and scope: JD-7, JD-11. +- P7 YAGNI: JD-2 (full sweep), JD-12 (unbounded widening). Step 1 and the loader for the chain targets both pass the + evidence test (observed re-render, `.discovery-notes.md` line 36). +- P8 Plain language: the restatement shows two changes bundled under one argument (JD-2). + +## Deferred (YAGNI) + +- Rewiring the roughly 32 skills that nothing chains. Reopen trigger: the block or probe needs a content change again. +- A general widening of property 2 to "values". Reopen trigger: a second validated values sub-skill. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-software-architect.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-software-architect.md new file mode 100644 index 00000000..897d4422 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-software-architect.md @@ -0,0 +1,406 @@ +# Round 1: software-architect + +Scope: the structure of the `han-core:load-han-config` loader, the consumer rewire across the shipped skills, and the +guidance edits around it. Every count below was measured on `main` at `abba73a` unless the discovery notes already +carried it. Findings are ordered by impact. + +## SA-1: The loader surfaces raw file content under today's labels, not resolved values + +- **Addresses:** issue-203.md#open-questions ("Does the personal-config Read survive consolidation?"), the "resolved + values" case in issue-203.md#proposal step 2, config-rule.md#the-two-files-the-two-probes-and-the-personal-read. +- **Principle:** SRP. The loader owns one thing, getting both files into context once. config-rule.md keeps owning + interpretation, and each skill keeps owning how a setting applies to it. +- **Recommendation:** the loader surfaces exactly what the 65-word block yields today, under byte-identical labels: + the `personal config directory` value, the `project .han/config.md` value, and the content of the personal file it + reads with the Read tool. It resolves nothing and emits no note. +- **Why not resolved values in a fixed shape:** the loader cannot finish the job, so a resolved shape splits + interpretation across two places. + - Precedence levels 1, 4, 5, and 6 (explicit input, CLAUDE.md, project-discovery, built-in defaults, + config-rule.md#precedence) are per skill. The loader could merge only levels 2 and 3. + - "A setting that does not apply to the running skill: ignore it silently" (config-rule.md#degradation-and-the-one-line-note) + means a note is right for one caller and wrong for another. The loader cannot emit it. + - A missing `writing-voice` file asks the user a question (config-rule.md#schema). That must happen in a prose skill + that uses the voice, not in a loader that every non-prose skill also calls. + - Byte-identical labels mean `readability-guidance` Step 1, `edit-for-readability` lines 82-84, `pairing` line 49, + and `project-discovery` line 112 read the same thing whether the loader or an old-style block (SA-6) put it there. + A new shape would force those four to handle two shapes. +- **Personal Read:** it survives, and it moves into the loader. The reason config-rule.md gives, that a probe "cannot + prompt and cannot degrade", still holds, because the loader also uses the Read tool rather than a probe. What moves + is who carries the instruction, not how the read happens. config-rule.md's opening paragraph and the first bullet + under its "two probes and the personal read" heading change wording (SA-8). +- **Trial implication:** the trial (issue-203.md#proposal step 2) should test this raw shape, because it is what ships. + The values in question are raw file content plus one directory path, a lighter load than a whole standard, which is + exactly the gap the issue names. +- **YAGNI evidence:** this is the strictly simpler of the two shapes. It needs no new schema and no consumer reading + change. +- **Contract (pinned):** see SA-2 for the rendered field layout two components must agree on. + +## SA-2: `han-core/skills/load-han-config/SKILL.md`, step by step + +- **Addresses:** issue-203.md#proposal step 3. Precedents: `readability-guidance/SKILL.md` (an inline surfacing + skill with an explicit RETURN instruction) and `project-discovery/SKILL.md` (probes plus the identical block). +- **Shape:** move the probe, the grant, and the instruction verbatim into one file, then add the hand-back. + +```markdown +--- +name: load-han-config +description: > + Brings this run's Han configuration (the personal and the project .han/config.md) into the calling skill's own + context, once per run, so the caller applies it per config-rule.md. Use when a Han skill's Project Context says to + resolve configuration with han-core:load-han-config. Runs in the caller's context and hands control straight back; + it resolves no setting, shows no note, and produces no deliverable. Does not write or edit .han/config.md. +allowed-tools: Read, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +--- + +## Project Context + +- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` +- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` + +# Load Han Configuration + +You invoked `load-han-config` to bring this run's Han configuration into your own context. This skill is inline: what +it surfaces stays in your context after it returns. It is not a stopping point or a final answer. + +## Step 1: Read the personal file + +Use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read that returns no file +is no personal configuration: continue silently. + +## Step 2: Hand back + +The `personal config directory` and `project .han/config.md` values above, and the personal file you just read, are +this run's Han configuration. They replace any copy surfaced earlier in this context. Apply them per +[config-rule.md](../../references/config-rule.md) at the point your own workflow uses a setting. Say nothing about the +configuration here. RETURN to the skill that invoked you and continue with its next step. +``` + +- **Rendered worked example** of what the caller's context holds after the call (project file present, no personal + file): + +```text +- personal config directory: /home/tami/.claude +- project .han/config.md: --- +output-directory: docs/han +--- +[Read /home/tami/.claude/.han/config.md -> file does not exist] +``` + +- **"Already resolved" reporting:** the loader does not report it and cannot detect it. Its probes inject at load, + before any instruction runs, so a second invocation has already paid its cost. It declares *latest wins* ("replace + any copy surfaced earlier") instead, so a second load is harmless and the newest content governs. SA-4 covers the + dedupe on the caller's side. +- **Link resolution:** the relative `../../references/config-rule.md` inside the loader resolves to the canonical + `han-core/references/config-rule.md`, not to a vendored copy. +- **Out of scope, said explicitly:** the July attempt's `show` and `set` modes (origin `han-config-skill` + investigation.md, "Behavior of the new skill" items 2 and 3) are not in issue #203's proposal. They are not planned. + See the YAGNI list. +- **Process:** CLAUDE.md requires `/han-plugin-builder:skill-builder` for the new skill. The long-form doc follows + `docs/templates/coverage-rule.md#the-inline-guidance-variant`, as readability-guidance's does. + +## SA-3: The consumer line, its placement, and the allowed-tools change (35 skills) + +- **Addresses:** issue-203.md#proposal step 4, and the open question "Is one line enough when a skill is invoked + directly?" +- **Who gets it:** the 35 shipped skills in plugins that depend on han-core. That is han-core 2, han-documentation 3, + han-research 3, han-planning 6, han-coding 11, han-github 3, han-atlassian 6, and han-ddd 1. `readability-guidance` + carries a variant (SA-5). The other 10 are covered in SA-5 and SA-6. +- **Exact text, pinned byte for byte:** use the issue's own line, unchanged. + `Resolve configuration with \`han-core:load-han-config\` if you have not already this run.` +- **Placement:** the line goes inside `## Project Context`, at the spot the 65-word paragraph held. The two config + probe lines are deleted, and any other probes (branch, CLAUDE.md, project-discovery.md) stay above the line. One + fixed location keeps the sweep and the grep gate mechanical. Where a skill's Project Context held only the config + probes, the heading stays and holds the line alone. +- **Continuation:** the "proceed" instruction lives in the loader's Step 2, following readability-guidance's + precedent. The caller adds none, so the issue's wording holds. The trial's worst-case arm (SA-10, Phase B) must run + this exact line with no caller-side continuation, since that is what ships. +- **allowed-tools:** remove `Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh")` from all 35. Whether to add + `Skill` is decided by SA-7. +- **Worked before/after** (`han-planning/skills/plan-a-feature/SKILL.md`): + +```diff + allowed-tools: +- Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *), +- Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") ++ Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *) + ... + ## Project Context +-- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` +-- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` +- +-As your first action, use the Read tool on ... [65 words] ... a file that reads but cannot be used. ++Resolve configuration with `han-core:load-han-config` if you have not already this run. +``` + +- **Sweep hazards the uniform swap misses (measured):** + - `han-ddd/skills/ddd-analysis/SKILL.md` lines 26-30 wrap the 65-word paragraph at different points than the other + 44 files. A line-based replace misses it, so the sweep script must match the paragraph with whitespace normalized. + - Three bodies cite the probe by name outside the block. `han-core/skills/pairing/SKILL.md:49` says "the + configuration probed above". `han-core/skills/project-discovery/SKILL.md:112` says "The Project Context probe + above". `readability-guidance` lines 46 and 48 are handled in SA-5. Each gets a hand edit that names the loader as + the source. + - A precedent shows why the gate matters: 0e5f44f, "The config-probe migration reached 42 of the 43 skills", is a + hand sweep that missed `pairing` and took the skill down. +- **Direct invocation:** the line names the skill by its qualified name. The loader's description must say when to use + it, which SA-2 does. The trial needs a top-level arm where the consumer runs with no prior config in context + (SA-10). + +## SA-4: Idempotence, meaning what "this run" means and why the check sits in the caller + +- **Addresses:** issue-203.md#the-duplication ("copies two and three tell a model that has already resolved the config + to resolve it again"), and V10 in the July investigation. +- **Assessment:** the conditional in the consumer line is the right mechanism, and the only possible one. A probe + cannot be conditional, so the skip has to happen before the loader is invoked, and only the caller's line can do + that. The line's check is content-based: the model looks for the surfaced values in context. That has two good + properties. + - After compaction drops the earlier copy, the check fails and the skill reloads. It heals itself. + - Inside a chain (pairing to tdd, an Atlassian wrapper to plan-a-feature, a caller to readability-guidance), the + first skill loads and the later ones skip. +- **The gap: "this run" carries only prose.** Pin it in config-rule.md (SA-8) as: *a run begins when the person + invokes a skill and ends when that skill finishes; every skill it invokes is part of the same run. A skill the person + invokes later in the same session is a new run and loads again.* Without that definition, a second slash command in + a long session could reuse a file the person edited in between. With it, the second command reloads, and the + loader's "latest wins" sentence (SA-2) makes the newer copy govern. +- **On a second invocation the loader** does nothing special and declares that its copy supersedes the earlier one + (SA-2). No detection step is added. It could not run before the probes anyway. +- **What the docs must now say:** `docs/configuration.md` line 7, "Every Han skill reads both files on every run", is + still true under the definition above, but it needs one added clause: "a skill invoked by another skill uses what + the first one loaded". The discovery notes flag this. + +## SA-5: The two chain-target guidance skills: explanation-guidance drops its block, readability-guidance takes the line with a fallback + +- **Addresses:** issue-203.md#the-duplication (the plan-a-feature to readability-guidance to explanation-guidance + chain), and V10. +- **explanation-guidance:** delete the whole block (both probes, the 65-word paragraph, and the Bash grant). Add no + loader line. Evidence: its body names no schema setting. A grep for `output-directory`, `default-swarm-size`, + `writing-voice`, `Extra Agents`, and `voice` returns 0. config-rule.md#degradation-and-the-one-line-note says a + setting that does not apply "ignore it silently". The block is dead weight, and deleting it is strictly simpler than + rewiring it. allowed-tools becomes `Read`. +- **readability-guidance:** drop its probes and carry the line plus one fallback sentence, because han-communication + does not depend on han-core (SA-6). Pinned text: + `Resolve configuration with \`han-core:load-han-config\` if you have not already this run. If that skill is not + available, treat this run as having no configuration.` + - Step 1's first bullet changes only its source phrase. "When either `.han/config.md` probe supplied a + `writing-voice` value" becomes "When the run's `project .han/config.md` value or personal `.han/config.md` supplied + a `writing-voice` value". Line 48 changes from "the probe reported" to "the run's `personal config directory` + value". + - allowed-tools becomes `Read`. + - Every shipped caller (23 distinct skills by the discovery measurement, 2 of them in han-reporting with the old + block) has config in context before it calls readability-guidance, so the fallback fires only on a direct + invocation without han-core. The + worst case is the built-in voice instead of a configured one, on a skill whose description positions it as a + sub-skill. +- **Result for the issue's chain:** one copy of the config and one instruction, down from three. +- **Not pinned:** how the model recognizes that "that skill is not available" is prose only. The Skill tool's + response to an unknown skill name decides it. + Unverified: could not inspect the Skill tool's response to an uninstalled qualified skill name, because no run + without han-core installed was available in this session. + +## SA-6: Degradation for the plugins without han-core: 10 skills, not 9; 8 keep the old block + +- **Addresses:** V11 (July). The count is now 10, because explanation-guidance shipped after July. The plugins are + han-communication 3, han-feedback 1, han-linear 1, han-plugin-builder 3, and han-reporting 2. +- **Options weighed:** + - **Add a han-core dependency.** Rejected at this altitude. CLAUDE.md states han-communication "depends on nothing", + and han-feedback and han-linear "depend on no other Han plugin". The plugin dependency graph is a relationship + between deployable units. Deferred to `system-architect`. + - **Accept the degradation (the July choice).** Users who install these plugins alone silently lose + `output-directory` and `writing-voice`. That is a regression with no finding that asks for it. + - **Keep the old block (recommended)** in the 8 skills nobody invokes from another skill: edit-for-readability, + han-feedback, work-items-to-linear, agent-builder, guidance, skill-builder, html-summary, and stakeholder-summary. + The issue itself says "a skill invoked on its own loads the block once" and that suite-wide duplication "is not the + problem". These 8 cause no in-context duplication, so the issue's finding does not reach them, and keeping the + block changes nothing for their users. +- **Cost of keeping it:** 8 copies of the probe and grant remain, still guarded by `scripts/han-config-dir.bats`. A + lookup change still lands in the script alone (SA-9). A wording change to the block touches 8 files, not 45. +- **YAGNI evidence:** this is the strictly simpler structure that satisfies the finding. It adds no fallback path and + changes no dependency. +- **Codex:** every han-* plugin ships a Codex manifest. + Unverified: could not establish whether Codex runs context-injection probes or lets one skill invoke another, because + nothing in the repo states it (discovery notes, "Gaps"). If Codex cannot run Skill calls, the 35 rewired skills lose + config under Codex. Deferred to `system-architect` as a cross-runtime concern. + +## SA-7: `Skill` in allowed-tools (V9) is decided by the trial, with both branches pinned + +- **Evidence:** 23 skills invoke `han-communication:readability-guidance`, and only 6 list `Skill` (discovery notes, + Measurements). This planning run invoked explanation-guidance from plan-implementation, whose allowed-tools omit + `Skill`, and it ran. `skill-composition.md#declare-the-skill-tool-in-allowed-tools` says "Without it the Skill call + is not permitted". + Unverified: could not determine the permission mode of the observing session, because it is not recorded. A + pre-approved or bypass mode would hide a prompt. +- **Recommendation:** add one trial arm that runs in default permission mode, with a consumer that lacks `Skill`. + - **If it prompts:** the sweep adds `Skill` to all 36 rewired skills. The 2 han-reporting skills, which call + readability-guidance without it today, are a pre-existing bug fixed in the same mechanical pass. + - **If it does not prompt:** correct that heading's sentence to say `allowed-tools` pre-approves a tool rather than + gating it, and add nothing to the 36. + - Either branch is one sed-able frontmatter edit or one guidance sentence. + +## SA-8: config-rule.md: edit the canonical copy, keep all 13 copies for now, and count what retiring them would break + +- **Edits (canonical, then re-sync the 12 copies byte for byte):** + - The opening paragraph's "Each participating skill finds both through its `## Project Context` block" becomes: + "Each participating skill finds both through `han-core:load-han-config`, invoked once per run; a skill in a plugin + that does not depend on han-core carries the probes in its own `## Project Context` block." + - The section with "two probes and the personal read" in its heading opens: "`han-core:load-han-config` carries the + two probe lines and directs one Read-tool call." The personal-read bullet's "The skill reads this file itself as + its first action" becomes "The loader reads this file with the Read tool". The rationale sentence stays verbatim. + - Add one paragraph pinning "run" and *latest wins*, in the wording SA-4 gives. +- **Retirement:** the July attempt said the vendored copies retire. Measured, they cannot all retire without more work, + and #203 does not ask for it. + - Retiring a copy breaks 27 mid-body SKILL.md lines across 18 skills, from a grep for `config-rule` excluding the + block line. ddd-analysis line 29 is its block, wrapped differently, and is not counted. + - It also breaks 7 lines in 5 skill reference files: `code-review/references/agent-dispatch.md:40`, + `iterative-plan-review/references/team-selection.md:59`, `plan-a-change/references/team-selection.md:33,69`, + `plan-a-feature/references/review-team-briefs.md:30`, and `plan-implementation/references/team-selection.md:32,73`. + - The 5 plugins in SA-6 need their copies regardless. + - After the sweep, the copies in han-documentation and han-github are referenced by nothing. They are harmless and + stay byte-identical. + - Kept: all 13. Retirement is listed under YAGNI with its trigger. +- **Mid-body links stay valid:** a band-selection citation that points at the local vendored copy still resolves, so + the sweep does not touch those 34 lines. + +## SA-9: `han-config-dir.sh` and its symlinks: the issue's claim about #172 is already true today + +- **Correction to issue-203.md#the-cost-is-already-visible:** "Under a consolidated loader, #172's config half becomes + one line inside `han-config-dir.sh`" has been true since #184 (52abdf4, 2026-08-19). Every probe already calls the + script, so `AGENT_CONFIG_DIR` is today the one-line change + `printf '%s\n' "${AGENT_CONFIG_DIR:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}}"`. + - Inside a script, a nested expansion is fine. The loader's refusal applies to probe text + (`context-injection-commands.md`, lines 140-215). + - What consolidation actually single-sources is the probe text, the grant, and the 65-word instruction. #184's + investigation counted those as "84 places to land", and they have been swept 4 times since 2026-07-30: e483783, + 78dc4f8, e79299f, and 55bdb1d, plus the missed `pairing`. That history is the measured friction, and it passes the + Rule of Three on its own. +- **The script stays.** Its callers become the loader plus the 8 old-block skills. +- **Symlinks:** keep the 6 in han-core, han-communication, han-feedback, han-linear, han-plugin-builder, and + han-reporting. Remove the 7 in han-atlassian, han-coding, han-ddd, han-documentation, han-github, han-planning, and + han-research, which no SKILL.md references after the sweep. The bats test "every plugin holding such a skill can + reach the resolver script" stays green either way. + +## SA-10: Sequencing: five phases, only one of which touches the 45 files + +| Phase | Lands | Touches SKILL.md? | Gate to start next | +| --- | --- | --- | --- | +| A | issue step 1: troubleshooting.md Cause 1 and checklist item 8 (SA-11, pre-trial wording) | no | none, it stands alone | +| B | issue step 2: trial artifacts under this plan's `artifacts/`, harness hot-loaded in `.claude/skills/`, OI-3 method | no | 0 early exits plus all carried facts present, in every arm | +| C | issue steps 3 and 5: loader skill, its long-form doc, han-core README scent line, both indexes, CLAUDE.md layout line, han-core minor bump, guidance widening (SA-11) | adds 1 new file | loader merged and unused, so it is safe alone | +| D | issue step 4: scripted sweep of 35, hand edits (readability-guidance, explanation-guidance, pairing, project-discovery), config-rule.md re-sync, bats, CONTRIBUTING.md:181-182, docs/configuration.md:7, graceful-degradation.md:102, symlink removal | yes | #172 no longer edits any SKILL.md | + +- **Phase B arms:** the arms beyond OI-3's are values-case inline, worst-case adversarial (no caller continuation, a + final-sounding loader close), depth-2 chain (consumer, then loader, then readability-guidance with its line), direct + top-level invocation, and default-permission without `Skill` (SA-7). If any arm fails, stop after Phase A. +- **Phase D gate, scripted:** + - The exact line appears in 36 files (35 plus readability-guidance). + - The 65-word paragraph, with whitespace normalized, appears in exactly 8. + - `han-config-dir.sh` appears in SKILL.md files in exactly 9: the loader plus the 8. + - explanation-guidance carries neither. + - Encode these as a new bats test beside `scripts/han-config-dir.bats`. Its existing probe and grant checks keep + passing over the 9. +- **#172, one sentence per option:** + 1. **#172 first:** rebase it so its config half is the one-line script change plus the config-rule.md wording, with + no SKILL.md edits, which is possible today (SA-9); Phase D then starts on a clean base. + 2. **#203 first:** hold #172 until Phase D merges, then rebase it to the same script line, at the price of keeping + #172 open for four phases. + 3. **Split #172:** land its Pi marketplace and compat half now (out of #203's scope), and treat its config half as + the script line whenever convenient. + - Recommended: 1 or 3. Both free #172 from the 45 files immediately, so Phases A through C can run while it is open. + The only remaining overlap is the 13 config-rule.md copies, which Phase D re-syncs anyway. + +## SA-11: Guidance edits, section by section + +All under `han-plugin-builder/skills/guidance/references/skill-building-guidance/`. + +- **troubleshooting.md, "### Cause 1: Data-fetch sub-skill (forked or inline)"** (Phase A): + - Retitle it to "Data-fetch sub-skill under `context: fork`". + - Keep the forked sentence verbatim, including the `api_retry` anchoring and the link. + - Replace the inline sentence with: "Inline, the sub-skill renders into the caller's context and returns no value to + anchor on; the OI-3 spike ran 34 same-context invocations with zero early exits (8c96157). That evidence covers + surfacing a standard; a values-only inline sub-skill is untested." Phase C rewrites the last clause to cite the + trial. + - Fix paragraph: "Do not fork a data-fetch sub-skill." Inline discovery stays the default, and the line points to the + exception in Skill Composition. + - Summary Checklist item 8: "Replace forked data-fetch sub-skills with inline discovery or an inline sub-skill under + Skill Composition's exception". +- **skill-composition.md** (Phase C): + - "## Data-fetch composition (avoid)" becomes "Forked data-fetch composition (avoid)". Its definition gains "under + `context: fork`". The failure account, from "The failure mode is concrete" through "the small amount of discovery + logic it saves", stays verbatim. + - "### Duplicate small discovery logic rather than sharing it through a skill" keeps its one-off advice and gains a + trigger: when one discovery block is copied into many skills and has had to be re-swept, surface it through an + inline sub-skill under the exception. The config block is the worked example: 4 sweeps, 1 of which missed a + skill. + - "### The one exception: surfacing a shared standard inline" becomes "surfacing shared content inline". Property 2 + becomes: "It surfaces content many consumers would otherwise duplicate (a whole standard, or a shared lookup's raw + results) and leaves interpretation to the caller; fetching one value for one skill is still inline discovery." + - Add the trial result beside the spike paragraph. Keep the "honest limit" paragraph and extend it with the trial's + own limits. + - "### Declare the Skill tool in `allowed-tools`" changes only per SA-7's outcome. + - "## Deciding which way to go": the "A few values" bullet splits into "values one skill needs: stay inline" and "a + lookup many skills share: an inline sub-skill under the exception". +- **writing-effective-instructions.md, "### Rule: Prefer inline discovery over forked data-fetch sub-skills"** + (Phase C): + - The rule is accurate as it stands, since it is fork-specific. Keep the account and the before/after unchanged. + - Change the closing paragraph's "data-fetch sub-skills that return structured values" to "forked data-fetch + sub-skills". + - Add one sentence pointing to Skill Composition's exception for a shared lookup surfaced inline. This closes the + cross-reference gap that V14 recorded. +- **graceful-degradation.md:102**, which the brief did not name: "Skills discover config inline ... rather than + calling a data-fetch sub-skill" becomes false after Phase D. Rewrite it to name the inline loader for + `.han/config.md` and inline discovery for other project values (Phase D). +- **context-hygiene.md:** no edit. The issue's quoted rule, "The attention cost is per-context, not per-file", does not + exist anywhere (discovery notes, Measurements). Line 104 is "Position critical content at the edges". If the plan + wants a citation for the cost of duplicate copies, use "### Rule: Every token must earn its place" (line 36) or + "### Rule: Treat stale context as a bug, not tech debt" (line 201). Do not carry the issue's quote. +- **Lag:** consumer repos that ran `guidance init` keep the old wording until they run `guidance update` (V15). Note + the lag. Do not push updates outward. + +## SA-12: Docs and contributor surfaces that move with Phase D + +- `CONTRIBUTING.md:181-182` tells authors to "copy the `personal config directory` probe and its matching ... grant". + It becomes: "carry the line `Resolve configuration with han-core:load-han-config if you have not already this run.` + in `## Project Context`; in a plugin that does not depend on han-core, copy the probe block from `edit-for-readability` + instead". The discovery notes cited lines 299-302, but the text is at 181-182 on `main`. +- `docs/configuration.md:7` gets the clause SA-4 gives. Line 29's "vendored byte-identical into each plugin" stays + true (SA-8). +- `CLAUDE.md`'s han-core description and layout line list `project-discovery` and `pairing`. Add `load-han-config` in + Phase C. + +## Software Architecture Recommendations Summary + +- **Upstream findings addressed:** + - Covered by SA-1 through SA-12: all five proposal steps in the issue, its four open questions, the V9, V10, and V11 + findings from the July attempt, and the discovery measurements on duplication, chain targets, the context-hygiene + citation, and #172. + - Intentionally not addressed: + - The issue's open question "Is there inline-failure evidence I missed?" belongs to the maintainer, and the + discovery notes' "Gaps" already record that none was found. + - #172's Pi marketplace entries are out of scope (scope-boundary.md#stated-exclusions). +- **Key themes:** + - Separate acquisition (loader) from interpretation (config-rule.md) from application (each skill). + - Put dedupe where it can act, which is the caller's line, because a probe cannot be conditional. + - Change the fewest files that the duplication finding actually reaches. That means 35 rewired, 2 chain targets hand + edited, and 8 untouched. +- **Highest-impact:** + - SA-1 and SA-2: the raw-content loader under the existing labels. + - SA-5: the chain targets. Deleting explanation-guidance's block alone removes one of the three copies. + - SA-10: phasing that keeps #172's overlap to the script line. +- **Deferred to `system-architect`:** + - The V11 option of adding han-core as a dependency of han-communication, han-feedback, han-linear, + han-plugin-builder, or han-reporting. It changes the plugin dependency graph, which is a relationship between + deployable units. + - Codex support for Skill-to-Skill calls and probes (SA-6). It is a cross-runtime packaging concern. +- **Deferred (YAGNI):** + - `show` and `set` modes (July V-plan). These are speculative features: issue #203 does not ask for them and no + finding needs them. Reopen when a user request to view or edit config through Han is recorded. + - Resolved-values output shape (SA-1). It is an abstraction with one consumer that could use it, + readability-guidance, and the other consumers cannot use it (per-skill precedence and notes). Reopen if a trial + arm shows models misapplying raw content, which would be measured friction. + - Retiring the vendored config-rule.md copies (SA-8). Out of #203's stated scope, with 34 citation lines to + rewrite. Reopen at the next config-rule.md edit that forces a 13-copy re-sync, or if a copy drifts. Even then only + 7 can retire. + - A fallback Read path in the 8 old-block skills, or a SessionStart hook. Both add a mechanism to solve a duplication + those skills do not have. Reopen if one of the 8 becomes another skill's Skill-call target. + - Scoped permission such as `Skill(han-core:load-han-config)`. Reopen only if SA-7's arm shows a prompt and a blanket + `Skill` grant is judged too broad. + Unverified: could not inspect whether Claude Code accepts a per-skill `Skill(...)` permission rule, because no + documentation for it is vendored in the repo. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-test-engineer.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-test-engineer.md new file mode 100644 index 00000000..3e0f7f5f --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/round-1-test-engineer.md @@ -0,0 +1,203 @@ +# Round 1: test-engineer findings, issue #203 (consolidate config loading) + +Sources read: `issue-203.md`, `scope-boundary.md`, `.discovery-notes.md` (Measurements relied on as measured), +`OI-3-spike-report.md` plus `harness-skills/spike-consumer-inline` and `spike-guidance-inline` and `spike-trials/INL-01.md`, +`scripts/han-config-dir.bats`, `han-core/references/config-rule.md`, `han-communication/skills/readability-guidance/SKILL.md`, +`evals/architectural-analysis/tests.json`, plugin manifests. Nothing was executed; every prediction below is from reading. + +## Coverage assessment + +Tested today: the resolver script's two outputs, and the probe and grant text in every skill that carries them +(`scripts/han-config-dir.bats`). Untested today: everything about what a skill does with resolved values. No test, bats or eval, +asserts that `output-directory`, `default-swarm-size`, `writing-voice`, or extra agents take effect (grep of `test/*.bats`, +`scripts/*.bats` for `config-rule` returns nothing; no eval folder covers config). The 12 vendored `config-rule.md` copies +have no byte-identity guard (same grep). So the sweep removes the only guarded surface and the new surface starts at zero. + +## Findings + +### TE-1: The trial is a values trial; build it as a clone of the spike's inline consumer plus a fixture config +- **Category:** Required (grounds step 2 of `issue-203.md#proposal`) +- **Entry point:** a harness consumer and a harness loader, created for the trial only, under the plan's artifacts folder + and hot-loaded into `.claude/skills/` as in `OI-3-spike-report.md#how-the-spike-was-built`, removed afterward. +- **Harness consumer (clone of `spike-consumer-inline`, six steps):** + 1. Read an incident file and extract four facts (reuse `incident-data.md`: `INC-4821 ERR_POOL_EXHAUSTED 8400ms checkout-api`). + 2. Hold them as a working note. + 3. Invoke the loader (the mid-workflow Skill call; the one line under test). + 4. Use each resolved value: write the artifact to `/.md`; state the swarm band and the file that + supplied it; read the writing-voice file and quote its sentinel line; list the extra agents it would add to its pool. + 5. Draft the five-section report (spike's step 4). + 6. Write the artifact and end with the completion token. +- **Completion token (pin it; the spike's token is the grammar to extend), exact worked example:** + `CONSUMER_COMPLETE | TRIAL_ID=CHN-03 | facts: INC-4821 ERR_POOL_EXHAUSTED 8400ms checkout-api | cfg: dir=trial-out-A swarm=large voice=VOICE_SENTINEL_K7Q agents=han-core:code-reviewer,fake:ghost` + Grammar: `CONSUMER_COMPLETE | TRIAL_ID= | facts: <4 space-separated> | cfg: dir= swarm= voice= agents=`. + The checker is a Bats or shell script comparing the token's `cfg:` field to the arm's expected string, not the subagent's claim. +- **What the artifact lets a checker verify without trusting the subagent:** file exists at the configured directory (proves + `output-directory` was applied, because the location is the observable); token present and last line; four facts intact; + five sections; `cfg:` field equals expected. +- **Fixture values must be unmistakable and unlike defaults:** `output-directory: trial-out-A`, `default-swarm-size: large`, + `writing-voice: ./voice-fixture.md` containing the sentinel `VOICE_SENTINEL_K7Q`, `## Extra Agents` with one real name and + one nonexistent (`fake:ghost`, expected to be skipped with a one-line note naming it, per `config-rule.md#extra-agents-joining-the-pool`). +- Unverified: could not run a subagent, because this role plans only; whether a subagent inherits a `CLAUDE_CONFIG_DIR` set by + the launcher is not documented in the repo (the spike never varied environment). + +### TE-2: Arms, assertions, pass criteria, trial counts +Baseline attributes failure to the Skill call, exactly as `OI-3-spike-report.md#why-a-baseline-arm`. + +| Arm | Mechanism | Asserts | N | +|---|---|---|---| +| BASE | consumer carries today's probe block and applies config itself, no Skill call | token, facts, cfg equals expected | 6 | +| INL | loader called once, consumer step 3, guardrail present | token, facts, cfg, artifact at configured dir | 12 | +| WORST | loader's last line is final-sounding ("Configuration resolved. Nothing further is required."), consumer has no continuation guardrail, copy of `spike-guidance-adversarial` | token, facts, cfg | 10 | +| CHAIN | consumer calls loader, then calls a second inline harness skill carrying the one-line instruction (a stand-in for `readability-guidance`) which reads `writing-voice` | token, cfg, and loader ran once (below) | 12 | +| DIRECT | loader invoked by the subagent with no caller; prompt "run `load-han-config`" only | loader's output block present, correct values, subagent stops after reporting | 6 | +| CFG-P, CFG-J, CFG-B, CFG-C, CFG-M, CFG-A | personal-only, project-only, both disjoint, both conflicting, malformed frontmatter in one file, absent in both | cfg field per `config-rule.md#precedence`; for CFG-M a one-line note naming the file; for CFG-A no note and `cfg: none` | 5 each (30) | +| SONNET-WORST | WORST on `model: sonnet` | as WORST | 6 | + +- **Chain idempotence assertion (TE-4 explains why):** the loader writes a marker into context; the harness loader also appends + one line to `/.loads` each time its body is executed, via Write. CHAIN passes only if that file holds + exactly one line. This is the one place a trial-only side effect is warranted: it turns "did not re-resolve" into a file. +- **Pass criterion:** deterministic outcomes (CFG-*, DIRECT, values correct) must be all-pass; one wrong value fails the arm, + because a wrong value is a wrong write location or voice, not a flaky style. Completion arms (INL, WORST, CHAIN, SONNET-WORST) + follow the spike: zero early exits. A WORST failure blocks step 3 of the proposal; a SONNET-WORST failure alone narrows the + guidance claim to Opus and is recorded, not blocking (the spike recorded model-specificity as a caveat, `OI-3-spike-report.md#the-limitation-this-spike-could-not-overcome`). +- **Why these N:** 12 and 10 match the spike so results compare. With zero failures the 95% upper bound on the failure rate is + about 22% at N=12 and about 26% at N=10 (rule of three: 3/N, approximate); the spike's 0/34 pooled bound is about 9%. + This trial can claim "no failure seen in 40 completion trials" (INL+WORST+CHAIN+DIRECT combine to 40 with the spike's 34 as a + separate population), not "cannot fail". The config-state arms are small (5) because their fixtures are deterministic and + the question is correctness of one resolution, not a rate. Total about 87 trials; one subagent each. +- Unverified: counts are my estimate of what the trial needs; the 95% bounds are arithmetic, not measured. + +### TE-3: What the trial cannot measure (record this in the trial report, not only in the guidance) +1. `api_retry`. The spike could not inject it and neither can this trial (`OI-3-spike-report.md#the-limitation-this-spike-could-not-overcome`). + The values case is the same exposure: the model resumes after a sub-skill returns. Say so, reduced by inference, not measured. + The only faithful test is an API-layer proxy forcing retries; recommend it as `Category: YAGNI candidate`, trigger: a + production report of an inline early exit (none exists, `.discovery-notes.md#gaps`). +2. Models other than the ones run (spike: Opus 4.8 only). SONNET-WORST narrows this, does not close it. +3. Codex. The notes record no statement of whether Codex runs probes or supports skill-to-skill calls + (`.discovery-notes.md#gaps`). The trial runs on Claude Code only; the Codex manifests are structural. +4. Whether `Skill` in `allowed-tools` is enforced: 6 shipped skills list it, 39 do not, and consumers like `plan-a-feature` do + already call `readability-guidance` (`.discovery-notes.md#the-works-figures-measured`, Skill-in-allowed-tools line). The + spike consumers granted `Skill`. Add one arm variant, INL-NOGRANT (consumer without `Skill` in allowed-tools, N=4), so the + guard in TE-6 requires or does not require the grant on evidence. Without it the guard is a guess. +5. Context-window contents. A subagent cannot show what is in its context; copies-in-context is inferred from the `.loads` + file and from the rendered probe text, not inspected. + +### TE-4: Idempotence of "if you have not already this run" needs a detectable signal; today it is prose only +- **Entry point:** the one-line instruction in `issue-203.md#proposal` item 4 and the future `han-core/skills/load-han-config/SKILL.md`. +- **Gap:** the line says "already this run" but nothing says how a model decides. In CHAIN the second skill sees the first skill's + loader output in context, so a visible marker is the only detectable signal. **Contract carrying only prose: flag.** + Pin a worked example of the loader's output (the contract the consumer, the second inline skill, and the guard all agree on): + ``` + HAN_CONFIG_RESOLVED | personal=present | project=absent + - output-directory: /home/u/out (personal .han/config.md) + - default-swarm-size: large (personal .han/config.md) + - writing-voice: /home/u/.claude/voice.md (personal .han/config.md) + - extra agents: han-core:code-reviewer (personal .han/config.md) + - note: + ``` + and the consumer rule "when a line beginning `HAN_CONFIG_RESOLVED` is already in your context, use it; do not invoke again". + Each value line names its source file, as `config-rule.md#degradation-and-the-one-line-note` already requires. +- **Test:** CHAIN arm (TE-2). Kill set: a loader that omits the marker, or a one-line instruction that omits "if you have not + already", makes the `.loads` file hold two lines; no existing test fails under either change (none touches config behavior). +- **Discriminating power for DIRECT:** the idempotence hint must not suppress a direct call; DIRECT guards that "already this + run" never turns the loader into a no-op when it is the first and only skill. + +### TE-5: Can Skillwalker evals host this? Partly, and not the trial +- **Evidence:** `evals/*/tests.json` fields (read `evals/architectural-analysis/tests.json`; counted across all files): + types `skill-prompt` and `skill-call`; `plugins`, `model`, `promptFile`, `scaffold`; expects `skill-call` (68), `agent-call` (36), + `llm-judge` (9), `result-contains` (10), `result-does-not-contain` (9). `scaffold` names a fixture project directory + (`evals/project-discovery/scaffolds/polyglot-project`), which can carry a project `.han/config.md`. +- **What it can host (regression layer, after step 3 ships):** a scaffold carrying a project `.han/config.md` with + `default-swarm-size: large` and a prompt invoking a swarm-sizing skill; expects `skill-call` for `han-core:load-han-config` + (a real behavior: the consumer's one line triggered the loader) and `result-contains` the announced band plus the supplying + file. A DIRECT eval (`skill-call` type, prompt "load my han config") also fits and answers the open question "is one line + enough when a skill is invoked directly" only for the loader's discoverability by description. Both are single-run checks + at one sample, so they are smoke tests, not trial evidence. +- **What it cannot host:** per-arm N, a `.loads` side-effect check, a completion token judged from a file on disk, a worst-case + arm with a rewritten loader, and the personal-only arms (no field sets `CLAUDE_CONFIG_DIR`; `promptFile`/`scaffold` are the + only inputs). `result-contains` checks the final result text, not an artifact path. +- **Verdict:** the trial needs the spike's subagent harness; evals host the shipping smoke layer. Keep the two separate. +- Unverified: could not inspect the Skillwalker runner or its docs, because no runner is in `package.json` and + `CONTRIBUTING.md` does not document it (`.discovery-notes.md#test-and-eval-surfaces`); a runner may support env or file setup + that `tests.json` fields do not show. + +### TE-6: Bats guards after the sweep (replace the probe guards in `scripts/han-config-dir.bats`) +Keep as is: resolver exists and is executable; honors `CLAUDE_CONFIG_DIR`; falls back to `$HOME/.claude` (these tests test the +script, which the loader still calls). Replace the four skill-scanning tests with the following. `consumers` = every shipped +`*/skills/*/SKILL.md` except the loader's. +1. **Every consumer carries the one line, verbatim, exactly once.** Exact text pinned from `issue-203.md#proposal` item 4: + `Resolve configuration with \`han-core:load-han-config\` if you have not already this run.` Assertion: `grep -cF` equals 1 + per consumer. Kill set: a skill that kept the old block and dropped the line, or paraphrased it. Today's exact-text test + already fails under paraphrase only for the old text, so this replaces it, not duplicates it. +2. **No consumer carries any of the old pieces:** no line matching `personal config directory`; no `.han/config.md` probe + `cat .han/config.md`; no `han-config-dir.sh` in `allowed-tools`; no `As your first action, use the Read tool`; no link to + `config-rule.md` unless the plan decides consumers still link it (decision needed: the issue is silent on the 12 vendored + copies, `issue-203.md#proposal`). Kill set: a half-swept skill. This is the guard against the 12-times-a-week churn the notes + record, so a hand edit that reintroduces the block is caught. +3. **Only the loader carries the probes and the grant:** loader contains the exact current `PROBE` and `GRANT` text and the + `As your first action, use the Read tool` instruction; exactly one SKILL.md in the repo does. Kill set: a second skill + quietly re-adding the probe (the double-load the issue describes). Also the existing "plugin can reach the resolver script" + test narrows to `han-core` only, since only the loader runs it. Kill set: deleting the `han-core/scripts` symlink. +4. **Dependency reachability, the structural test the five non-han-core plugins force:** for every consumer, the plugin's + `.claude-plugin/plugin.json` lists `han-core` in `dependencies`, or the skill is on an explicit allow-list. Measured today: + han-communication, han-feedback, han-linear, han-plugin-builder, han-reporting carry zero `"han-core"` matches in their + manifests (my check above; han-core's manifest also matches zero for dependencies). The test turns the open decision into a + failing test, so nobody can ship a one-line instruction pointing at an uninstalled skill. Without it, nine skills (per + `.discovery-notes.md`, V11) degrade silently. +5. **Loader is inline and contained:** frontmatter has no `context: fork` (the property the spike disqualified, + `OI-3-spike-report.md#the-decisive-secondary-finding-forked-does-not-surface-content`), and its `allowed-tools` grants `Read` + and the exact script command. Kill set: someone adding `context: fork`, which drops values on the floor. +6. **Callers that invoke a skill grant `Skill`:** only if INL-NOGRANT (TE-3 item 4) shows it matters; otherwise drop. Category: + YAGNI candidate until measured; trigger: INL-NOGRANT shows a failure, or the loader's enforcement is documented. +7. **Index completeness for the new skill:** long-form doc, plugin README scent line, skills index entry. Existing guard: none + found in `test/`; `docs/templates/coverage-rule.md` is a rule, not a test. Add one bats check only if the plan adds the others + by hand; otherwise a review gate. Category: YAGNI candidate; trigger: first merged skill missing an index entry. +8. **Byte-identity of surviving `config-rule.md` copies**, if any survive: no guard exists today; with a loader the copies drift + risk drops. Category: YAGNI candidate; trigger: plan keeps more than the canonical copy. +- **Brittleness:** 1 pins one sentence; accepted because that sentence is the cross-component contract (a consumer, the loader, + the guard), and the guard exists so a change is made once. Tests 2 and 3 use `grep -cF` on literal text, as the current bats does. + +### TE-7: Behaviors the plan must cover (from your list), with test level and evidence +| Behavior | Level | Evidence and assertion | +|---|---|---| +| Chain idempotence | trial (CHAIN) | TE-4; `.loads` has one line | +| Loader invoked directly | trial (DIRECT) then one eval | answers `issue-203.md#open-questions` item 3 for discoverability: the loader's `description` must name config resolution; assert a direct prompt triggers `skill-call` | +| Consumer in a non-`han-core` plugin without `han-core` | bats TE-6.4 plus one manual run | Behavior is not specified by the issue: pick fail-closed or accept degradation. Manual run: install only `han-reporting`, run `stakeholder-summary`, assert it completes and says nothing broken. Cannot be automated here (no installer in harness). | +| Personal-config Read degrading silently | trial arm CFG-P with the personal directory pointed at a missing path (add CFG-P-MISSING, N=5) | `config-rule.md#degradation-and-the-one-line-note`: no note, no error, project values still apply. Today `scripts/han-config-dir.bats` does not touch this. Open question 2 of the issue (`issue-203.md#open-questions`) is the decision moving to the loader; this arm verifies it survived. | +| readability-guidance resolving `writing-voice` after the loader | trial CHAIN stand-in, then one real-skill run | `readability-guidance/SKILL.md` Step 1 reads "either `.han/config.md` probe". After the sweep that probe is gone, so Step 1 must read the loader's `writing-voice` line instead. **This is a required edit with no stated owner; flag.** Assertion: the artifact quotes `VOICE_SENTINEL_K7Q` from the configured file; a missing voice file yields the warning and the question, not silence. | +- **Structural problem the trial does not surface:** `readability-guidance` and `explanation-guidance` live in `han-communication`, + which depends on nothing (`CLAUDE.md` project map); a `han-core:load-han-config` call from them cannot resolve when han-core + is absent. These two are the loader's main chain targets (24 and 8 callers per the issue), so TE-6.4 will fail on them first. + Options for the plan to choose, not for me: they keep their own block (undoing the issue's headline win for them), or + han-communication gains a han-core dependency (breaks "depends on nothing"), or the loader lives in han-communication. + Unverified: could not inspect how Claude Code resolves a qualified skill name when the plugin is absent, because it needs a + live install; the repo records no measurement. + +### TE-8: Test doubles +None recommended. Real files (fixture `.han/config.md`, real `voice-fixture.md`, real resolver script) and real skills are usable +everywhere. The one non-real element is the harness loader variant used for WORST and for the `.loads` write; it is a +trial-only skill, deleted afterward as the spike's scaffolding was, and the shipped loader is tested unmodified in the eval +smoke layer (TE-5) and bats (TE-6). Do not mock `Skill` or `Read`; a mock would remove the behavior under test. + +### TE-9: Guidance correction (step 1 of the proposal) test +- **Entry point:** `han-plugin-builder/skills/guidance/references/skill-building-guidance/troubleshooting.md:473` (line number measured + in the notes). A bats check is justified only for the one false citation the notes found: `context-hygiene.md:104` quote + "The attention cost is per-context, not per-file" does not exist. Assertion: `! grep -rF "The attention cost is per-context" han-plugin-builder/` + after the edit. Kill set: carrying the issue's wrong quote into the guidance. Priority: Medium; cheap and the failure is + specific. Do not add a bats test for wording of the rewritten rule (brittle prose snapshot). + +## Deferred / Skipped (YAGNI) + +- **S1 API-layer retry injection proxy.** Category: YAGNI candidate. Behavior guarded: early exit after `api_retry`; no recorded + inline occurrence. Trigger: a user report of an inline early exit. Discriminating power: not determined; no existing test + injects retries, so no existing test fails under the change this would catch, and none could. +- **S2 Per-skill eval for all 45 consumers.** Category: YAGNI candidate. The one-line sentence is the same everywhere and TE-6.1 + pins it; one DIRECT eval plus the CHAIN trial catch the realistic failures. Trigger: a consumer whose line is not the + canonical one (an exception to TE-6.1). +- **S3 Codex run of the trial.** Trigger: the notes' gap closes (Codex documents skill-to-skill calls). +- **S4 Re-run of 34-trial spike arms on the loader unmodified.** The spike's standard result stands; the values case is the + open question (`issue-203.md#what-the-evidence-shows`, last paragraph). + +## Priority and counts +High: TE-1, TE-2, TE-4, TE-6 (1, 2, 3, 4, 5), TE-7 readability and non-han-core rows. Medium: TE-3 INL-NOGRANT, TE-5 smoke evals, TE-9. +Low: TE-6.6 to 6.8 as YAGNI candidates. Skipped: S1 to S4. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/scope-boundary.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/scope-boundary.md new file mode 100644 index 00000000..617ba361 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/scope-boundary.md @@ -0,0 +1,61 @@ +# Scope Boundary: Consolidate config loading (issue #203) + +## Work Item + +GitHub issue testdouble/han#203, "Consolidate config loading; the inline half of the data-fetch prohibition is +unevidenced", opened by @taminomara. Fetched from the GitHub API at planning time and copied verbatim to +[`../issue-203.md`](../issue-203.md), together with the one comment on it from the maintainer (@mxriverlynn), which +says they "would love to have you digging into this" and that "for long term maintenance, i definitely want a better +solution." + +## Stated Scope + +The issue's Proposal section, quoted word for word: + +> 1. Correct `troubleshooting.md:473` to match the evidence, or attach evidence I did not find. +> 2. Run an OI-3-shaped trial on the values case, with a worst-case arm. +> 3. If it holds, add `load-han-config` to `han-core`, beside `project-discovery`, already the precedent for +> machine-written, skill-consumed project context. +> 4. Cut each consuming skill's block to one line: "Resolve configuration with `han-core:load-han-config` if you have not +> already this run." The idempotence hint keeps a chain resolving once. +> 5. Widen property 2 of the exception to match the trial. +> +> Step 1 stands regardless, since the guidance currently contradicts its own spike. + +The issue also names the problem it addresses: "A `plan-a-feature` run that invokes `readability-guidance` and then +`explanation-guidance` puts three copies of the config content and three of the instruction into one context window", +and "this is a five-skill problem rather than a 44-skill one." + +## Stated Exclusions + +Quoted from the issue: + +> Under a consolidated loader, #172's config half becomes one line inside `han-config-dir.sh`. Its Pi marketplace +> entries and compat checks are unaffected. + +> Nothing here blocks it and the Pi work stands on its own; the note is only that its config half sits on a probe form +> #184 removed, so it needs a rebase regardless. + +So the Pi marketplace entries and compat checks of #172 are out of scope. The issue also states "I am not claiming the +values case is proven", so step 3 onward is conditional on the trial in step 2 holding. + +## Operator-Stated Scope + +The operator's request, quoted: "Read https://github.com/testdouble/han/issues/203 and make a plan". No further scope +was stated. + +## Direction of Travel + +Unanswered. The run is autonomous and took no confirmation turn. The issue itself implies the answer for the things it +names: the per-skill config block is being replaced by a one-line invocation, and the `troubleshooting.md` wording is +being corrected rather than removed. `han-config-dir.sh` is kept and becomes the single place a lookup changes. + +## Visual Material Received + +None received + +## Record Provenance + +Established by `han-planning:plan-implementation` in this run, from the issue text fetched via the GitHub API. No +upstream `plan-a-feature` record existed. The operator's confirmation turn was not taken because the run was +autonomous; the recorded scope is the issue's own text and the operator's one-line request. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/sweep/rewire-config-block.py b/docs/plans/gh-203-consolidate-config-loading/artifacts/sweep/rewire-config-block.py new file mode 100644 index 00000000..e8c555ca --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/sweep/rewire-config-block.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +"""Issue-203 sweep: replace the per-skill config block with the one-line loader instruction. + +Usage: rewire-config-block.py [--check] + +For every shipped SKILL.md (every han-*/skills/*/SKILL.md), except the loader itself and +explanation-guidance (handled by hand), the script: + 1. removes the two config probe lines from `## Project Context`; + 2. replaces the 65-word instruction paragraph (matched with whitespace normalized, so the + differently wrapped copy in ddd-analysis is caught) with the pinned line; + 3. removes the han-config-dir.sh grant from allowed-tools. +--check reports what would change and exits 1 if any file still carries an old piece afterwards. +""" +import glob, os, re, sys +root = sys.argv[1]; check = "--check" in sys.argv +LINE = "Resolve configuration with `han-core:load-han-config` if you have not already this run.\n" +PROBE1 = '- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"`\n' +PROBE2 = '- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""`\n' +GRANT = 'Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh")' +PARA_WORDS = ("As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read " + "that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` " + "probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence " + "between the two files, relative-path resolution, and what to do with a file that reads but cannot be used.").split() +para_re = re.compile(r"As your first action, use the Read tool on(?:.|\n)*?cannot be used\.\n") +SKIP = {"han-core/skills/load-han-config/SKILL.md", "han-communication/skills/explanation-guidance/SKILL.md"} +changed = []; leftovers = [] +for path in sorted(glob.glob(os.path.join(root, "han-*/skills/*/SKILL.md"))): + rel = os.path.relpath(path, root) + if rel in SKIP: continue + s = open(path).read(); orig = s + m = para_re.search(s) + if m and m.group(0).split() == PARA_WORDS: + s = s[:m.start()] + LINE + s[m.end():] + s = s.replace(PROBE1, "").replace(PROBE2, "") + # grant: remove with its separator, whichever side it sits on + s = re.sub(r",\s*" + re.escape(GRANT), "", s); s = re.sub(re.escape(GRANT) + r",\s*", "", s); s = s.replace(GRANT, "") + s = re.sub(r"allowed-tools:\n\s*\n", "allowed-tools:\n", s) # no empty continuation line + s = re.sub(r"(\n## Project Context\n)\n+(" + re.escape(LINE.strip()) + ")", r"\1\n\2", s) + if s != orig: + changed.append(rel) + if not check: open(path, "w").write(s) + for piece, name in ((PROBE1, "probe1"), (PROBE2, "probe2"), (GRANT, "grant"), ("As your first action, use the Read tool", "paragraph")): + if piece in s: leftovers.append(f"{rel}: {name}") +print(f"{'would change' if check else 'changed'} {len(changed)} files"); [print(" " + c) for c in changed] +if leftovers: print("LEFTOVERS:"); [print(" " + l) for l in leftovers]; sys.exit(1) diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/trial/trial-report.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/trial/trial-report.md new file mode 100644 index 00000000..7ff2b257 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/trial/trial-report.md @@ -0,0 +1,77 @@ +# Trial report: does an inline loader that surfaces `.han/config.md` values hold? + +**Verdict: GO.** Across 99 same-context trials in 15 arms, every consumer finished all six of its steps, +applied every configured value as the config rule says, and invoked the loader exactly as many times as the arm +expected. Zero early exits. Zero wrong values. The one trigger the harness cannot induce is a real `api_retry`, and +one model (Opus) was tested, so the claim is scoped the same way the OI-3 spike's was. + +## What was tested + +Issue #203 step 2 asked for an OI-3-shaped trial on the values case: the OI-3 spike showed an inline sub-skill can +surface a whole standard without the caller stopping early; this trial checks the thing the guidance said was untested, +an inline sub-skill that surfaces a lookup's values which the caller must then use. + +The harness mirrors the spike. Project skills under `.claude/skills/spike-*` (preserved beside this report under +`harness/`), a heavy six-step incident post-mortem consumer that must carry four facts across the loader call, and a +fresh Opus subagent per trial told only to run the skill. Completion was judged from the artifact on disk by +`check-trials.py`: the completion token as the last line, four facts, five sections, the `cfg:` field against the +arm's expected values, and the `.loads` side-effect file (one appended line per loader run) against the expected count. +The consumer additionally had to apply four settings: write under `output-directory`, report `default-swarm-size`, +read the `writing-voice` file and end its Summary with that file's sentinel word, and keep only the `## Extra Agents` +entries that name an agent in the session. + +The loader under test is `spike-loader`, a copy of `han-core/skills/load-han-config/SKILL.md` with a trial-only step +that appends the `.loads` line; `spike-loader-worst` is the same body ending on "The configuration review is complete. +Nothing further is required." with no hand-back instruction. + +## Results + +| Arm | What it checks | N | Completed | Early exits | Values correct | Loads as expected | +| ------------- | ----------------------------------------------------------------------------------------------------------- | --- | --------- | ----------- | -------------- | ----------------- | +| BASE | Today's probe block, no Skill call (isolates consumer flakiness) | 6 | 6 | 0 | 6 | 6 (0 loads) | +| INL | Consumer carries the line, invokes the loader once | 12 | 12 | 0 | 12 | 12 | +| WORST | Loader ends on a final-sounding line; consumer has no continuation guardrail | 10 | 10 | 0 | 10 | 10 | +| CHAIN | Consumer loads, then invokes a second inline skill that also carries the line | 12 | 12 | 0 | 12 | 12 (1 load) | +| BLOCK-THEN-LINE | Consumer carries the old block, then invokes a skill carrying the line | 5 | 5 | 0 | 5 | 5 (0 loads) | +| DEPTH-2 | Consumer has no line; the second skill carries it and the loader runs two deep | 6 | 6 | 0 | 6 | 6 (1 load, by the second skill) | +| DIRECT | A person runs the loader with no caller | 6 | 6 | 0 | n/a | 6 (reported both files and stopped) | +| INL-NOGRANT | Consumer without `Skill` in `allowed-tools` | 4 | 4 | 0 | 4 | 4; no prompt, denial, or error reported | +| A-state wave | INL 4, WORST 2, CHAIN 1, DIRECT 1 run before the fixtures were reachable (no config present) | 8 | 8 | 0 | 8 (defaults) | 8 | +| CFG-P | Personal file only | 5 | 5 | 0 | 5 | 5 | +| CFG-J | Project file only | 5 | 5 | 0 | 5 | 5 | +| CFG-C | Both files set everything; project wins each scalar, agents are the union | 5 | 5 | 0 | 5 | 5 | +| CFG-M | Project frontmatter malformed; personal applies; the parse failure is noted | 5 | 5 | 0 | 5 | 5 | +| CFG-A | Neither file; every default | 5 | 5 | 0 | 5 | 5 | +| CFG-P-MISSING | Personal directory does not exist; project applies; no note, no error | 5 | 5 | 0 | 5 | 5 | + +Every arm above ran with both fixture files present and disjoint (project: output directory and swarm band; personal: +voice and extra agents) unless its row says otherwise. The checker's per-trial output is in `check-*.log`; the manifests +that fed it are `manifest-*.json`; every artifact and `.loads` file is under `trials/` (and `trials-A-state/` for the +first wave). + +## What the trial settles + +- **The caller resumes after a values-only inline sub-skill**, including when the sub-skill ends on a stopping + sentence and the caller carries no guardrail. Several WORST testers wrote, unprompted, that the closing line "ended + only the loader's own work." +- **"If you have not already this run" works as a content check.** In every CHAIN and BLOCK-THEN-LINE trial the + second skill's line was read against the context and skipped; in every DEPTH-2 trial the second skill loaded because + nothing had. +- **Raw content under the old labels is enough.** Callers applied precedence, personal-relative voice paths, the + malformed-file rule, and the unresolvable-agent rule from the config rule without the loader resolving anything. +- **A missing `Skill` grant did not prompt or fail** in this session's permission mode (4/4). The mode is auto, so a + prompt may have been auto-approved; the arm shows the call completes, not that no prompt exists in default mode. + +## What it does not settle + +- `api_retry` was never induced; the harness cannot inject an infrastructure fault. +- Only Opus testers ran, by direction; a smaller-model worst-case arm was planned and dropped. +- Codex was not exercised. +- One harness defect: the CFG-P fixture gave the personal file a relative `output-directory` while the consumer stated + the personal-relative rule only for `writing-voice`. 3 of 5 testers applied the config rule's reading and 2 the + working directory; both were accepted for that arm, and the later personal fixtures use an absolute path. + +## Reproducibility + +`harness/` holds every SKILL.md and the fixture files; `check-trials.py` and the manifests reproduce the verdicts from +`trials/`. The harness skills were removed from `.claude/skills/` after the run. diff --git a/docs/plans/gh-203-consolidate-config-loading/artifacts/trial2/trial-report.md b/docs/plans/gh-203-consolidate-config-loading/artifacts/trial2/trial-report.md new file mode 100644 index 00000000..b85db2e2 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/artifacts/trial2/trial-report.md @@ -0,0 +1,87 @@ +# Trial 2 report: does the shipped single-probe loader hold? + +**Verdict: GO.** Across 48 same-context trials in 10 arms, every consumer finished all six of its steps, applied every +configured value as the config rule says, and reported the skill invocation sequence its arm expected. Zero early +exits. Zero wrong values. This trial ran the loader as shipped, `han-core:load-han-config` installed from a local +marketplace, so the one gap the first trial named (cross-plugin name resolution of the shipped skill) is closed. The +same two limits remain: no real `api_retry` was induced, and one model (Opus) was tested. + +## Why a second trial + +The first trial (`../trial/`) ran a project-skill copy of the loader as it stood then: two context-injection probes +plus a Read-tool step for the personal file. After that trial the loader was reduced to a single probe whose script +resolves both files, prints them between markers with the config rule, or says neither was found and lists the paths +tried. The vendored config-rule copies were retired and the script moved into `han-core`. This trial checks that the +shipped shape, reached by its cross-plugin name, holds under the same composition arms and configuration states. + +## What was tested + +The harness mirrors the first trial. Project skills under `.claude/skills/spike-*` (preserved beside this report under +`harness/skills/`, with the fixtures under `fixtures/`), a heavy six-step incident post-mortem consumer that must carry +four facts across the loader call and apply four settings, and a fresh Opus subagent per trial told only to run the +skill. Completion was judged from the artifact on disk by `check-trials.py`: the completion token as the last line, the +four facts, the five sections, and the `cfg:` field against the arm's expected values. + +Two things differ from the first trial: + +- **The loader is the shipped skill.** Every arm but WORST invokes `han-core:load-han-config` from the installed + plugin, whose single probe runs `han-core/scripts/load-han-config.sh`. WORST invokes `spike-loader-worst`, a copy of + that script whose output ends on "The configuration review is complete. Nothing further is required." with no + hand-back sentence. +- **No `.loads` counter.** The shipped loader has no side-effect step to append to, and adding one would have meant + testing a copy again. The invocation sequence was taken from each tester's final report instead, which was told to + list every Skill tool call in order. That is the one check this trial could not make from disk. + +The fixture state for the composition arms is B: the project file sets `output-directory` (`out-J`, an absolute path) +and `default-swarm-size: large`; the personal file sets `writing-voice` (voice-P, sentinel `VOICE_SENTINEL_P9Z`) and +`## Extra Agents` (`han-core:risk-analyst` and the nonexistent `fake:phantom`). The project skills had to be symlinked +into the main checkout's `.claude/skills/`, because a session registers project skills from the checkout it started +in, not the worktree it works in; three plumbing runs made before that link existed are not counted. + +## Results + +| Arm | What it checks | N | Completed | Early exits | Values correct | Sequence as expected | +| ------ | ------------------------------------------------------------------------------------------------- | --- | --------- | ----------- | -------------- | --------------------------------------------------- | +| INL | Consumer carries the line, invokes the shipped loader once | 8 | 8 | 0 | 8 | 8 (consumer, loader) | +| WORST | Loader copy ends on a final-sounding line; consumer has no continuation guardrail | 6 | 6 | 0 | 6 | 6 (consumer, loader copy) | +| CHAIN | Consumer loads, then invokes a second inline skill that also carries the line | 6 | 6 | 0 | 6 | 6 (consumer, loader, second skill; no reload) | +| DEPTH2 | Consumer has no line; the second skill carries it and the loader runs two deep | 4 | 4 | 0 | 4 | 4 (consumer, second skill, loader) | +| DIRECT | A person runs the shipped loader with no caller | 4 | 4 | 0 | n/a | 4 (reported both files and stopped) | +| CFG-P | Personal file only | 4 | 4 | 0 | 4 | 4 | +| CFG-J | Project file only | 4 | 4 | 0 | 4 | 4 | +| CFG-C | Both files set everything; project wins each scalar, agents are the union | 4 | 4 | 0 | 4 | 4 | +| CFG-M | Project frontmatter malformed; personal applies; the parse failure is noted | 4 | 4 | 0 | 4 | 4 | +| CFG-A | Neither file; the loader prints its not-found branch; every default, no note | 4 | 4 | 0 | 4 | 4 | + +The composition arms ran in two waves against state B (`manifest-B-wave1.json` for the first 11, `manifest-B.json` for +all 28); the configuration arms ran one state at a time, since the probe reads the filesystem when the skill loads +(`manifest-CFG.json`). The checker's output is in `check-B.log` and `check-CFG.log`. Artifacts sit where each arm's +`output-directory` sent them: `out-J/`, `out-P/`, and `trials/` for CFG-A. + +## What the trial settles + +- **The shipped loader resolves by its cross-plugin name and hands control back**, including two skills deep and + behind a worst-case closing line. Several WORST testers wrote, unprompted, that the closing line ended only the + loader's own work. +- **One probe is enough.** Callers applied precedence, the personal file's absolute paths, the malformed-file rule, the + union of both agent lists, and the unresolvable-agent note from the printed rule, with the loader resolving nothing. +- **The not-found branch degrades silently.** All four CFG-A consumers used every default and carried no note about + the missing configuration, as the branch instructs. +- **"If you have not already this run" still works as a content check** in the shipped shape: every CHAIN tester + skipped the second skill's line, and every DEPTH2 tester loaded through it. + +## What it does not settle + +- `api_retry` was never induced; the harness cannot inject an infrastructure fault. +- Only Opus testers ran, by direction. +- Codex was not exercised. +- The invocation sequence is self-reported by each tester, not read from a side-effect file. +- An in-session reload (a second run in the same session after a config edit) was not measured; every trial ran in a + fresh context. + +## Reproducibility + +`harness/skills/` holds every SKILL.md and the worst-case script; `fixtures/` holds the incident data, the five +configuration files, and the two voice files. `check-trials.py` with the manifests reproduces the verdicts from the +artifact folders. The harness skills, their symlinks in the main checkout, and the fixture configuration files were +removed after the run. diff --git a/docs/plans/gh-203-consolidate-config-loading/feature-implementation-plan.md b/docs/plans/gh-203-consolidate-config-loading/feature-implementation-plan.md new file mode 100644 index 00000000..a927ea7c --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/feature-implementation-plan.md @@ -0,0 +1,579 @@ +# Feature Implementation Plan: Consolidate config loading (issue #203) + +This plan replaces the 65-word config block that every Han skill carries with one shared, inline loader skill. A chain +of skills then loads `.han/config.md` once instead of once per skill. The work runs in four gated phases. The guidance +correction ships on its own first. A trial on the values case comes next and gates everything else. Then the loader +lands unused in `han-core`, as the issue's step 3 says ([D-1](artifacts/implementation-decision-log.md#d-1-loader-lives-in-han-core-with-five-new-dependency-edges)), and the five plugins +that do not yet declare `han-core` gain it as a dependency ([D-21](artifacts/implementation-decision-log.md#d-21-five-plugins-gain-a-direct-han-core-dependency)). Only after that +does the scripted sweep rewire the skills. The dependency edges go past the issue's text: the user chose them so every +skill can reach the loader, and they are the one item the maintainer may decline at review. + +## Outcome + +When this plan is done, a person who runs a chained skill such as `plan-a-feature` gets one copy of their Han +configuration in the conversation, not three. Every shipped skill that uses a setting points at a shared loader in one +line, and the loader carries the two probes and the personal-file read that used to be copied into each skill. No skill +keeps the old block, and nobody loses a setting. The cost is that installing `han-communication`, `han-feedback`, +`han-linear`, `han-plugin-builder`, or `han-reporting` now also installs `han-core`. + +The maintainer gets one place to change how config is found. The plugin-building guidance stops forbidding what its own +spike measured as working, and it names the config loader as the second validated case of an inline shared sub-skill. +If the trial fails, only the guidance correction and the removal of one unused block ship, and no plugin gains a +dependency. + +## User Stories + +- **US-1:** As an operator who runs a skill that invokes other skills, I want my configuration loaded once per run, so + that later skills in the chain are not told to load it again and the context holds one copy. +- **US-2:** As an operator who invokes any Han skill directly, I want my `output-directory`, `default-swarm-size`, + `writing-voice`, and extra agents to keep taking effect, so that consolidation changes nothing I can observe except + the duplication. +- **US-3:** As the maintainer who changes how config is looked up, I want that lookup to live in one skill and one + script, so that the next change edits a few files instead of sweeping 45. +- **US-4:** As the maintainer who authors skills against the plugin-building guidance, I want that guidance to say only + what the evidence shows about inline sub-skills, so that I do not avoid a pattern the measurements support. + +## Constraints and Boundaries + +- **Driving constraint:** the maintainer asked for "a better solution" for long-term maintenance and does not like + "having everything trying to load the config file when it's already loaded" (comment on the issue). The block has + been swept four times since July, and one hand sweep missed `pairing` and broke it (commit `0e5f44f`). PR #172 is + open against the same files. +- **Recorded boundary:** issue #203's five proposal steps, with steps 3 to 5 conditional on the trial holding. See + [artifacts/scope-boundary.md](artifacts/scope-boundary.md). +- **User direction past the boundary:** the five new `han-core` dependency edges are not among the issue's five + steps. The user added them after reading the plan (E1 in the iteration history), so that every skill reaches the + loader. +- **Out of scope:** + - PR #172's Pi marketplace entries and compat checks, which the issue excludes by statement. + - `show` and `set` modes on the loader, retiring the vendored `config-rule.md` copies, and running the trial under + Codex. Each is in Deferred (YAGNI) with its trigger. + - No security or operations surface changes. The loader reads the same two files the block reads today, with the + same tools, so no threat or runtime review was needed. +- **Corrections to the issue the plan carries (measured, not decisions):** + - 45 of 45 shipped skills carry the probe, not 44 of 47. + - `readability-guidance` has 23 consuming skills, not 24. `explanation-guidance` has about 7, not 8. + - About 13 skills are Skill-call targets, not five. The fix shape is the same for all of them. + - "#172's config half becomes one line inside `han-config-dir.sh`" has been true since #184. It is not a benefit of + consolidation. + - The quoted rule "The attention cost is per-context, not per-file" at `context-hygiene.md:104` does not exist. No + guidance edit carries it. +- **Watch after ship:** + - Consumer repos that ran `guidance init` keep the old guidance wording until they run `guidance update`. + - A report of a chained skill misapplying raw config content reopens the resolved-values shape. + - Installs of `han-communication`, `han-feedback`, `han-linear`, `han-plugin-builder`, or `han-reporting` now pull in + `han-core` and its 22 agents. + +## Implementation Approach + +The work moves three things out of every skill and into one inline loader: the two config probes, the Bash grant for +the resolver script, and the instruction to read the personal file. Each skill keeps one line that names the loader and +tells the model to skip it when the config is already in context this run. The shared config rule keeps owning how +settings are interpreted, and each skill keeps owning how a setting applies to it. The loader only brings the files into +context. + +The loader is inline, never forked. It renders into the caller's context, so whatever it surfaced stays there after it +returns, which is how `readability-guidance` already works. That is the property the OI-3 spike measured (34 of 34 +same-context invocations, zero early exits) and the property a forked loader would lose. + +### Where the loader lives + +The loader goes in `han-core`, beside `project-discovery`, as the issue's step 3 says +([D-1](artifacts/implementation-decision-log.md#d-1-loader-lives-in-han-core-with-five-new-dependency-edges)). Today only seven +plugins depend on `han-core`, and they exclude both guidance skills the issue's chain runs through. So the five +plugins that do not declare `han-core` gain it as a direct dependency: `han-communication`, `han-feedback`, +`han-linear`, `han-plugin-builder`, and `han-reporting` +([D-21](artifacts/implementation-decision-log.md#d-21-five-plugins-gain-a-direct-han-core-dependency)). After that, every +plugin is `han-core` or depends on it, and every one of the 45 skills can reach the loader. + +The new edges create no cycle. `han-core/skills` and `han-core/agents` hold zero references to `han-communication`, +which is why the install-footprint plan (`docs/plans/reduce-required-install-footprint/investigation.md`) cut the +edge from `han-core` to `han-communication`. The edges do cost something, and D-21 records each cost: + +- CLAUDE.md, CONTRIBUTING.md, `docs/concepts.md`, `docs/choosing-a-han-plugin.md`, the `han-communication` plugin + description, and its marketplace entry all say `han-communication` depends on nothing. They change. +- `docs/concepts.md` line 266 offers a reporting-only install "without the `han-core` agent roster". That stops being + true. +- `han-communication` is 196K and `han-core` is 896K with 22 agents, so installing any of the five now pulls in the + agent roster. +- The suite declares every edge directly, so each of the five manifests gains its own `han-core` edge, mirrored in + `.claude-plugin/marketplace.json` where an entry narrates dependencies. Codex manifests have no dependency field and + do not change. + +- Skill path: `han-core/skills/load-han-config/SKILL.md` +- Qualified name every consumer uses: `han-core:load-han-config` + +### What the loader surfaces + +> Superseded in part after execution: the shipped loader is a single probe whose script prints both files and +> the rule ([D-23](artifacts/implementation-decision-log.md#d-23-the-loader-is-one-probe-whose-script-prints-both-files-and-the-rule)), +> the twelve vendored copies of the rule are gone ([D-24](artifacts/implementation-decision-log.md#d-24-the-vendored-config-rulemd-copies-are-retired)), +> and the script is a regular file in `han-core/scripts/` with no symlink ([D-25](artifacts/implementation-decision-log.md#d-25-the-loader-script-lives-in-han-core-not-at-the-repo-root)). + +The loader surfaces raw file content under today's exact labels and resolves nothing +([D-2](artifacts/implementation-decision-log.md#d-2-loader-surfaces-raw-file-content-under-the-existing-labels)). It +emits no note. Because the labels are byte-identical to the old block's, a skill reading config sees the same text +whether the loader or an old-block skill put it there. The loader is built through `/han-plugin-builder:skill-builder` +([D-19](artifacts/implementation-decision-log.md#d-19)) from the software-architect's sketch (SA-2 in +[round-1-software-architect.md](artifacts/round-1-software-architect.md)) as written. Its rule link, +`../../references/config-rule.md`, resolves to the canonical copy in `han-core`. + +These values are pinned. The builder may refine the rest of the body. + +- Frontmatter: `name` and `allowed-tools` exactly as below, and no `context` key (never `context: fork`). The + description must name `han-core:load-han-config` and the phrase "resolve configuration" so a direct + invocation finds it. + + ```yaml + name: load-han-config + allowed-tools: Read, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + ``` + +- Probe lines: byte-identical to today's two lines. + + ```markdown + - personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` + - project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` + ``` + +- H1, which is also the already-loaded marker: `# Load Han Configuration` +- Hand-back paragraph, verbatim (the link inside it is the loader's own relative link to the canonical + `config-rule.md` in `han-core`, not a plan artifact): + + ```markdown + The `personal config directory` and `project .han/config.md` values above, and the personal file you just read, are + this run's Han configuration. They replace any copy surfaced earlier in this context. Apply them per + [config-rule.md](../../references/config-rule.md) at the point your own workflow uses a setting. Say nothing about + the configuration here. RETURN to the skill that invoked you and continue with its next step. + ``` + +- Rendered worked example of what the caller's context holds after the call, with a project file present and no + personal file: + + ```text + - personal config directory: /home/tami/.claude + - project .han/config.md: --- + output-directory: docs/han + --- + [Read /home/tami/.claude/.han/config.md -> file does not exist] + ``` + +### How a chained skill knows the config is already loaded + +A later skill in the chain sees the loader's own rendered body in its context: the `# Load Han Configuration` heading +and the hand-back paragraph. That is the marker, and no separate marker line is added +([D-3](artifacts/implementation-decision-log.md#d-3-rendered-loader-body-is-the-already-loaded-marker)). When the +loader runs twice, the latest copy wins, because the hand-back paragraph says so. A copy dropped by compaction fails the +check, and the skill loads again. + +"This run" gets a pinned definition in the shared config rule +([D-4](artifacts/implementation-decision-log.md#d-4-definition-of-a-run)): + +> A run begins when the person invokes a skill and ends when that skill finishes. Every skill it invokes is part of the +> same run. A skill the person invokes later in the same session is a new run and loads again. + +### The line each consumer carries + +Each consumer's `## Project Context` holds this line where the 65-word paragraph sat. The two config probes and the +script grant are removed. Any other probes in that section stay above the line +([D-5](artifacts/implementation-decision-log.md#d-5-the-consumer-line-and-where-it-sits)). + +```markdown +Resolve configuration with `han-core:load-han-config` if you have not already this run. +``` + +Whether `Skill` joins each consumer's `allowed-tools` is decided by the trial's no-grant arm, with both branches pinned +in advance ([D-8](artifacts/implementation-decision-log.md#d-8-skill-grant-decided-by-trial)). + +### Which skills change + +Every skill takes the line, except `explanation-guidance`, which uses no setting and loses its block outright. No skill +keeps today's block ([D-6](artifacts/implementation-decision-log.md#d-6-which-skills-carry-the-line)). + +- 44 skills carry the line: every shipped skill except `explanation-guidance`. That includes `han-core`'s own + `project-discovery` and `pairing`, `readability-guidance` and `edit-for-readability`, `han-feedback`, + `work-items-to-linear`, and `han-plugin-builder`'s `agent-builder`, `guidance`, and `skill-builder`. + - `readability-guidance` Step 1 changes only its source phrases. "Either `.han/config.md` probe" becomes the run's + `project .han/config.md` value or personal `.han/config.md`, and "the probe reported" becomes the run's + `personal config directory` value. It needs no fallback sentence, because `han-communication` depends on + `han-core` once D-21 lands. +- `explanation-guidance` deletes both probes, the paragraph, and the Bash grant, and carries no line. +- `guidance init` also vendors `han-plugin-builder`'s skills into consumer repos, to run with no plugin installed. The + vendored copies carry the line unchanged. Where `han-core` is installed, the line reaches the loader; where it is + not, the run has no configuration, and the long-form `guidance` doc says so + ([D-22](artifacts/implementation-decision-log.md#d-22-vendored-plugin-builder-copies-carry-the-line-unchanged)). Before the sweep, the + implementer confirms this by reading `han-plugin-builder/skills/guidance/scripts/init-guidance.sh`. Read during this + revision, it copies `skill-builder` and `agent-builder` verbatim apart from the `plugin-` renames, and the vendored + `guidance` comes from `assets/guidance-portable-SKILL.md`, which carries no config block. + +The sweep is scripted and grep-gated, not done by hand +([D-7](artifacts/implementation-decision-log.md#d-7-scripted-and-grep-gated-sweep)). Three hazards travel with it: + +- `ddd-analysis` wraps the paragraph at different points, so the script matches it with whitespace normalized. +- `pairing` line 49 and `project-discovery` line 112 cite "the probe above". These get hand edits that point them at + the run's `personal config directory` value from the loader instead. +- Commit `0e5f44f` shows a hand sweep that missed `pairing`. The count gate below catches the same miss. + +### The shared config rule and the resolver script + +> Superseded in part after execution: the shipped loader is a single probe whose script prints both files and +> the rule ([D-23](artifacts/implementation-decision-log.md#d-23-the-loader-is-one-probe-whose-script-prints-both-files-and-the-rule)), +> the twelve vendored copies of the rule are gone ([D-24](artifacts/implementation-decision-log.md#d-24-the-vendored-config-rulemd-copies-are-retired)), +> and the script is a regular file in `han-core/scripts/` with no symlink ([D-25](artifacts/implementation-decision-log.md#d-25-the-loader-script-lives-in-han-core-not-at-the-repo-root)). + +The canonical `han-core/references/config-rule.md` is edited once and re-synced byte for byte into the 12 vendored +copies. All 13 copies stay ([D-9](artifacts/implementation-decision-log.md#d-9-edit-config-rule-once-and-keep-all-13-copies)). + +- The opening paragraph says skills find both files through `han-core:load-han-config`, invoked once per run. +- The section on the two probes and the personal read opens by saying the loader carries the two probe lines and directs + one Read-tool call. The rationale for the Read tool stays verbatim. +- One new paragraph carries the run definition above and the latest-wins rule. + +`scripts/han-config-dir.sh` stays as the single place a lookup changes. Its symlinks narrow to `han-core`, the only +plugin whose SKILL.md still calls it ([D-10](artifacts/implementation-decision-log.md#d-10-script-stays-and-its-symlinks-narrow)). + +- Kept: `han-core/scripts/han-config-dir.sh` (the loader). +- Removed: the other 12, in `han-atlassian`, `han-coding`, `han-communication`, `han-ddd`, `han-documentation`, + `han-feedback`, `han-github`, `han-linear`, `han-planning`, `han-plugin-builder`, `han-reporting`, and + `han-research`. + +### The trial + +The trial reruns the OI-3 subagent harness on the values case before anything ships past the guidance correction +([D-12](artifacts/implementation-decision-log.md#d-12-trial-harness-arms-and-pass-criterion)). Harness skills are +hot-loaded under `.claude/skills/` and removed afterward. Each trial runs in a fresh subagent told only to run the +skill. Every artifact lands under `artifacts/trial/` in this plan folder. + +- Fixture values, chosen to be unlike any default: + - `output-directory: trial-out-A` + - `default-swarm-size: large` + - `writing-voice: ./voice-fixture.md`, a file whose sentinel line is `VOICE_SENTINEL_K7Q` + - `## Extra Agents` listing `han-core:code-reviewer` and the nonexistent `fake:ghost` +- Carried facts from the spike's incident file: `INC-4821 ERR_POOL_EXHAUSTED 8400ms checkout-api` +- Completion token, the last line of every consumer artifact. Grammar, then a worked example: + + ```text + CONSUMER_COMPLETE | TRIAL_ID= | facts: <4 space-separated> | cfg: dir= swarm= voice= agents= + CONSUMER_COMPLETE | TRIAL_ID=CHN-03 | facts: INC-4821 ERR_POOL_EXHAUSTED 8400ms checkout-api | cfg: dir=trial-out-A swarm=large voice=VOICE_SENTINEL_K7Q agents=han-core:code-reviewer,fake:ghost + ``` + +- Load counter: the harness loader appends one line to `/.loads` each time its body runs. The + write must append, never overwrite, or a double load reads as one. Grammar, then a worked example: + + ```text + LOADED | TRIAL_ID= | by= + LOADED | TRIAL_ID=CHN-03 | by=trial-consumer + ``` + +- A checker script compares each token's `cfg:` field to the arm's expected string and counts `.loads` lines. It never + trusts the subagent's own claim. + +| Arm | What it checks | N | +| -------------- | ---------------------------------------------------------------------------------------------------------------- | --- | +| BASE | Consumer carries today's block and calls no skill; isolates consumer flakiness | 6 | +| INL | Consumer calls the loader once, mid-workflow, through the pinned line | 12 | +| WORST | Loader ends on a final-sounding line and the consumer has no continuation guardrail | 10 | +| SONNET-WORST | WORST on the smaller model | 6 | +| CHAIN | Consumer loads, then calls a second skill carrying the line; `.loads` holds exactly 1 line | 12 | +| BLOCK-THEN-LINE | Consumer carries the old block, then calls a skill carrying the line; `.loads` holds 0 lines | 5 | +| DEPTH-2 | Consumer calls a second skill that carries the line and itself invokes the loader; `.loads` holds exactly 1 line | 6 | +| DIRECT | Subagent runs the loader with no caller; correct values surface and it stops | 6 | +| INL-NOGRANT | Consumer without `Skill` in `allowed-tools`, default permission mode; records whether a prompt appears | 4 | +| CFG-P, CFG-J, CFG-B, CFG-C, CFG-M, CFG-A | Personal only, project only, both disjoint, both conflicting, malformed, absent in both | 5 each | +| CFG-P-MISSING | Personal directory points at a missing path; no note, no error, project values still apply | 5 | + +The trial passes when every arm shows zero early exits and every carried fact and configured value is present. A +SONNET-WORST failure on its own narrows the guidance claim to the larger model and does not fail the trial. INL-NOGRANT +selects a branch rather than passing or failing. If any other arm fails, only the guidance correction and the +`explanation-guidance` block deletion ship +([D-13](artifacts/implementation-decision-log.md#d-13-what-ships-if-the-trial-fails)). + +Skillwalker evals do not host the trial, because they cannot express per-arm counts, a side-effect file, or an artifact +check. They host one post-ship smoke eval of the shipped loader +([D-17](artifacts/implementation-decision-log.md#d-17-skillwalker-hosts-a-post-ship-smoke-eval-only)). + +### The guidance edits + +All guidance edits sit under `han-plugin-builder/skills/guidance/references/skill-building-guidance/` +([D-16](artifacts/implementation-decision-log.md#d-16-guidance-corrections-and-bounded-widening)). + +- Before the trial, `troubleshooting.md` Cause 1 is retitled to the forked case. Its inline sentence is replaced with + the spike's measured result and this pre-trial clause: "a values-only inline sub-skill is untested." Summary checklist + item 8 changes to match. +- After the trial, `skill-composition.md` narrows "data-fetch composition (avoid)" to the forked case. The exception + becomes "surfacing shared content inline", and property 2 takes this bounded wording, naming the config loader as the + second validated case: + + > It surfaces content many consumers would otherwise duplicate (a whole standard, or a shared lookup's raw results) + > and leaves interpretation to the caller; fetching one value for one skill is still inline discovery. + +- `writing-effective-instructions.md` keeps its fork-only rule and gains one cross-reference to the exception. +- `graceful-degradation.md` line 102 is rewritten in the sweep phase to name the inline loader. +- `context-hygiene.md` is not edited. A citation for the cost of duplicate copies uses "Every token must earn its place" + or "Treat stale context as a bug, not tech debt", never the issue's nonexistent quote. + +### The guards that replace the probe checks + +`scripts/han-config-dir.bats` keeps its three script tests and replaces the skill-scanning tests with a count gate +([D-11](artifacts/implementation-decision-log.md#d-11-bats-guards-replace-the-probe-checks)). The counts are the +contract between the sweep script and the test. The test "every plugin holding such a skill can reach the resolver +script" stays, and now covers only `han-core`. + +| Assertion | Expected count | +| ------------------------------------------------------------------------------------------------- | -------------- | +| SKILL.md files carrying the consumer line verbatim, exactly once each | 44 | +| SKILL.md files carrying the 65-word paragraph (whitespace normalized) | 0 | +| SKILL.md files referencing `han-config-dir.sh` (the loader alone) | 1 | +| `explanation-guidance` carries the line, the paragraph, or the script | 0 | +| Line carriers whose plugin is not `han-core` and does not list it in `dependencies` (every plugin) | 0 | +| Loader frontmatter containing `context: fork` | 0 | + +## Work Units and Sequencing + +Phase A ships on its own. Phase B gates C and D. Phase C lands the loader unused and the five dependency edges, so it +is safe alone: nothing calls the loader yet, and the edges only add an install. Phase D starts only when PR #172 no +longer edits any SKILL.md +([D-14](artifacts/implementation-decision-log.md#d-14-four-phases-with-gates), +[D-15](artifacts/implementation-decision-log.md#d-15-sequencing-with-pr-172)). + +| # | Work Unit | Story | Delivers | Justification | Depends On | Verification | +| --- | -------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------- | +| 1 | Phase A: guidance correction | US-4 | `troubleshooting.md` Cause 1 and checklist item 8 say the inline values case is untested, not unreliable | Issue step 1: "Correct `troubleshooting.md:473` to match the evidence"; "Step 1 stands regardless" | — | Review against SA-11; the nonexistent context-hygiene quote appears nowhere in `han-plugin-builder/` | +| 2 | Phase A: version bump | US-4 | One `han-plugin-builder` patch bump, kept in sync in `marketplace.json` | Necessity of unit 1: `docs/semantic-versioning.md` requires a bump so users receive the change | 1 | `npm test` (`test/codex-packaging.bats`) passes | +| 3 | Phase B: trial harness and fixtures | US-1, US-2 | Harness consumer, harness loader, WORST variant, second inline skill, fixture configs, voice file, checker script | Issue step 2: "Run an OI-3-shaped trial on the values case, with a worst-case arm" | — | Checker run against one hand-made passing and one failing artifact | +| 4 | Phase B: run the trial and report | US-1, US-2 | All arms run; `artifacts/trial/` holds every artifact, `.loads` file, and a report stating pass or fail, the INL-NOGRANT branch, and the trial's limits | Issue step 2 and step 3's condition: "If it holds" | 3 | Checker output for every arm; harness skills removed from `.claude/skills/` | +| 5 | Phase C: loader skill | US-1, US-3 | `han-core:load-han-config`, built through `/han-plugin-builder:skill-builder`, with the pinned frontmatter, probes, H1, and hand-back | Issue step 3: "add `load-han-config` to `han-core`" ([D-1](artifacts/implementation-decision-log.md#d-1-loader-lives-in-han-core-with-five-new-dependency-edges)) | 4 passes | Bats: loader has no `context: fork`; DIRECT smoke run | +| 6 | Phase C: loader doc surfaces | US-3 | Long-form doc under the inline-guidance variant, `han-core` README scent line, skills index entry, CLAUDE.md layout line for `han-core` | Necessity of unit 5: CLAUDE.md "Indexes stay complete" and `docs/templates/coverage-rule.md` | 5 | Index review lists the new skill in all three places | +| 7 | Phase C: `han-core` dependency edges | US-1, US-2 | `han-core` added to `dependencies` in the `han-communication`, `han-feedback`, `han-linear`, `han-plugin-builder`, and `han-reporting` manifests, mirrored in `.claude-plugin/marketplace.json`; CLAUDE.md, CONTRIBUTING.md, `docs/concepts.md` (including line 266), `docs/choosing-a-han-plugin.md`, the five plugin descriptions, and the five front-door READMEs say so | Necessity of the user's direction that every skill reach the loader (E1) ([D-21](artifacts/implementation-decision-log.md#d-21-five-plugins-gain-a-direct-han-core-dependency)) | 4 passes | `npm test` passes; no surface says any of the five depends on nothing or on no other Han plugin; `han-core/skills` and `han-core/agents` still hold zero references to `han-communication` | +| 8 | Phase C: guidance widening | US-4 | `skill-composition.md` exception and property 2 in the bounded wording; trial result beside the spike; `writing-effective-instructions.md` cross-reference; Cause 1 cites the trial | Issue step 5: "Widen property 2 of the exception to match the trial" | 4 passes | Review against SA-11; wording names the config loader, not values in general | +| 9 | Phase C: version bumps | US-3, US-4 | `han-core` minor bump; at least a patch for each of the five plugins gaining an edge; `han-plugin-builder` covered by one bump for its edge and unit 8 unless unit 2's branch already covers it | Necessity of units 5, 7, and 8: `docs/semantic-versioning.md` (adding a skill is minor) ([D-20](artifacts/implementation-decision-log.md#d-20)) | 5, 7, 8 | `npm test` passes; `marketplace.json` matches every `plugin.json` | +| 10 | Phase D: shared config rule | US-2, US-3 | Canonical `config-rule.md` names the loader, carries the run definition and latest-wins, and is re-synced into all 12 copies | Necessity of issue step 4: the rule pins the per-skill probes, which become false after the sweep | 5, #172 gate | All 13 copies share one checksum | +| 11 | Phase D: scripted sweep and hand edits | US-1, US-3 | 44 skills carry the line; `explanation-guidance` drops its block; `readability-guidance` Step 1, `pairing`, and `project-discovery` hand edits; 12 unused symlinks removed; INL-NOGRANT branch applied | Issue step 4: "Cut each consuming skill's block to one line" | 5, 7, 10, #172 gate | Unit 12's count gate | +| 12 | Phase D: Bats guards | US-3 | `scripts/han-config-dir.bats` carries the count gate in place of the probe-in-every-skill checks | Necessity of unit 11: today's tests assert the probe in every skill and would fail; the gate is what catches a missed file | 11 | `npm test` passes; deliberately reverting one swept file fails it | +| 13 | Phase D: contributor and operator docs | US-2, US-3 | `CONTRIBUTING.md` "Adding a skill" step 2, `docs/configuration.md` line 7 clause, `graceful-degradation.md` line 102, CLAUDE.md's `scripts/` layout comment, the symlink count in `test/codex-packaging.bats`'s header comment, and the `guidance` long-form doc's note on vendored copies | Necessity of units 11 and 7: each describes the per-skill block, the symlinks, or the vendored skills as they were ([D-18](artifacts/implementation-decision-log.md#d-18-docs-and-contributor-surfaces-move-with-the-sweep)) | 11 | Each statement is true against the swept tree | +| 14 | Phase D: version bumps | US-2 | One patch bump for every plugin whose files changed (all 13, through the config-rule re-sync), recalculated from baseline | Necessity of units 10 to 13: `docs/semantic-versioning.md` ([D-20](artifacts/implementation-decision-log.md#d-20)) | 10 to 13 | `npm test` passes; `marketplace.json` matches every `plugin.json` | +| 15 | Post-ship smoke eval | US-2 | One Skillwalker eval: a scaffold with a project config, asserting the loader is called and the configured swarm band is announced | Necessity of unit 5: the trial tests a harness copy, so the shipped loader needs one check of its own ([D-17](artifacts/implementation-decision-log.md#d-17-skillwalker-hosts-a-post-ship-smoke-eval-only)) | 14 | The eval passes once on the shipped plugins | + +Unit 15 rests on a runner nobody could inspect. Unverified: could not inspect the Skillwalker runner, because no runner +is in `package.json` and `CONTRIBUTING.md` does not document it. + +## Definition of Done + +- [ ] `troubleshooting.md` no longer says inline data-fetch is unreliable without evidence + ([D-16](artifacts/implementation-decision-log.md#d-16-guidance-corrections-and-bounded-widening)). +- [ ] The trial report under `artifacts/trial/` records every arm's count and result, the INL-NOGRANT branch taken, and + what the trial cannot measure ([D-12](artifacts/implementation-decision-log.md#d-12-trial-harness-arms-and-pass-criterion)). +- [ ] If the trial failed, nothing past Phase A and the `explanation-guidance` deletion merged + ([D-13](artifacts/implementation-decision-log.md#d-13-what-ships-if-the-trial-fails)). +- [ ] Running `plan-a-feature` shows one `# Load Han Configuration` heading in context and no 65-word paragraph from + any later skill in the chain ([D-3](artifacts/implementation-decision-log.md#d-3-rendered-loader-body-is-the-already-loaded-marker)). +- [ ] A skill invoked directly with a project `.han/config.md` applies its `output-directory`. +- [ ] `npm test` passes with the count gate at 44, 0, and 1 + ([D-11](artifacts/implementation-decision-log.md#d-11-bats-guards-replace-the-probe-checks)). +- [ ] The five manifests declare `han-core`, `marketplace.json` mirrors them, and no doc surface says any of the five + depends on nothing ([D-21](artifacts/implementation-decision-log.md#d-21-five-plugins-gain-a-direct-han-core-dependency)). +- [ ] The `guidance` long-form doc says vendored skills apply config only when `han-core` is installed, and the + implementer's read of `init-guidance.sh` is recorded in the PR + ([D-22](artifacts/implementation-decision-log.md#d-22-vendored-plugin-builder-copies-carry-the-line-unchanged)). +- [ ] All 13 `config-rule.md` copies are byte-identical and carry the run definition + ([D-9](artifacts/implementation-decision-log.md#d-9-edit-config-rule-once-and-keep-all-13-copies)). +- [ ] The loader has a long-form doc, a scent line, an index entry, and a CLAUDE.md layout mention + ([D-19](artifacts/implementation-decision-log.md#d-19)). +- [ ] Every changed plugin has exactly one bump for its branch ([D-20](artifacts/implementation-decision-log.md#d-20)). +- [ ] `CONTRIBUTING.md`, `docs/configuration.md`, `graceful-degradation.md`, and CLAUDE.md's `scripts/` comment describe + the loader and the single symlink + ([D-18](artifacts/implementation-decision-log.md#d-18-docs-and-contributor-surfaces-move-with-the-sweep)). +- [ ] Nothing in `## Deferred (YAGNI)` was built, or its `Reopen when:` trigger fired and is recorded. + +## Testing Strategy + +- **Observable behaviors to test:** + - A chained run loads config once: the CHAIN, DEPTH-2, and BLOCK-THEN-LINE `.loads` counts. + - Configured values take effect after the loader returns: the artifact lands in `trial-out-A`, the token carries the + voice sentinel and the band. + - The caller keeps working after an inline sub-skill returns, including under a final-sounding loader close. + - A direct invocation surfaces the config and stops. + - Precedence and degradation hold across the six config states and a missing personal directory. +- **Edge cases requiring coverage:** malformed frontmatter in one file; a nonexistent extra agent (`fake:ghost`, skipped + with a one-line note); no config anywhere (`cfg: none`, no note); the `ddd-analysis` paragraph wrapping; a skill that + carries the old block calling one that carries the line (BLOCK-THEN-LINE; after the sweep no shipped skill keeps the + block); a vendored `plugin-skill-builder` in a repo without `han-core` (D-22, checked by reading `init-guidance.sh`, + not by a trial arm). +- **Test doubles posture and levels:** no doubles. Real files, real skills, and the real resolver script. The only + non-real parts are trial-only harness skills, deleted afterward. The trial is the behavior level; Bats guards the + sweep's structure; one Skillwalker eval smoke-tests the shipped loader. + +## Risks and Assumptions + +Risk IDs use `RK-` so they are not confused with round IDs. + +### Risks + +| ID | Risk | Impact | Mitigation | Owner | +| ---- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | +| RK-1 | An `api_retry` event after the loader returns anchors the caller, the failure behind the forked account. No harness can inject it. | A caller stops early and treats the loader's output as its answer. | The loader returns no value to anchor on and ends with RETURN; the trial report states the gap; fault injection is deferred with a trigger. | test-engineer | +| RK-2 | The trial runs on one or two models, so the result may not hold for others. | The guidance claim overreaches. | SONNET-WORST arm; a failure there narrows the claim instead of passing silently. | test-engineer | +| RK-3 | Codex may not run probes or Skill-to-skill calls, so rewired skills could lose config under Codex. | Codex users lose their settings. | No new exposure class: 23 skills already rely on a Skill call to `readability-guidance` under Codex. Tracked as OI-4. | software-architect | +| RK-4 | The sweep misses or half-edits a file, as commit `0e5f44f` did. | A skill loses config or breaks at load. | Scripted sweep with whitespace-normalized matching and the Bats count gate. | test-engineer | +| RK-5 | Consumer repos keep the old guidance wording until they run `guidance update`. | Their authors keep avoiding the pattern. | Accepted; noted in the release notes. No outward push. | maintainer | +| RK-6 | Missing `Skill` in `allowed-tools` may prompt or block in default permission mode. | Rewired skills prompt or fail to load config. | INL-NOGRANT arm selects the branch before the sweep: add `Skill` to every line carrier, or correct the guidance sentence ([D-8](artifacts/implementation-decision-log.md#d-8-skill-grant-decided-by-trial)). | test-engineer | +| RK-7 | PR #172 lands SKILL.md edits while the sweep runs. | Merge conflicts across 44 files. | Phase D gate: #172 no longer edits any SKILL.md. | maintainer | +| RK-8 | The maintainer declines the five `han-core` dependency edges at review. | Rework to the `han-communication` placement. | The superseded design is recorded in D-1's rejected alternatives and differs by one plugin folder and seven skills; Phase B gates the edges, so nothing past the trial is built on them before review. | maintainer | + +### Assumptions + +| ID | Assumption | What Changes If Wrong | Status | +| --- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ------------ | +| A1 | Every line carrier's plugin is `han-core` or declares it in `dependencies`, and dependencies are hard requirements. | The loader could be absent and the line would point at nothing. | Verified for the 7 plugins that declare it today (plugin manifests; discovery notes, dependency graph); true for the other 5 once unit 7 lands, checked by the count gate | +| A2 | A Skill-invoked sub-skill re-renders its probes and block today. | The duplication the plan removes would not exist. | Verified (observed in this run; discovery notes) | +| A3 | `Skill` in `allowed-tools` pre-approves rather than gates the call. | The sweep adds `Skill` to every line carrier. | Runtime-only (INL-NOGRANT arm) | +| A4 | The subagent harness predicts behavior in a real session. | The trial result does not transfer; the post-ship smoke eval is the backstop. | Runtime-only | +| A5 | No unrecorded inline-failure evidence exists behind "both forms". | The Phase A wording changes to cite it, and the trial may need a new arm. | Open (OI-1) | +| A6 | Codex supports a skill invoking another skill. | Rewired skills lose config under Codex. | Open (OI-4) | + +## Deferred (YAGNI) + +This is work no evidence supports yet, not work the work item excludes. Every entry carries the trigger that would +justify revisiting it. + +### `show` and `set` modes on the loader + +- **Why deferred:** evidence test. Issue #203 does not ask for them and no finding needs them. +- **Reopen when:** a user request to view or edit config through Han is recorded. +- **Source:** R1, software-architect (SA-2), inherited from the July `origin/han-config-skill` branch. + +### Resolved-values output with a `HAN_CONFIG_RESOLVED` marker line + +- **Why deferred:** simpler-version test. Raw content under the existing labels meets the same need, and interpretation + is per skill. See the rejected alternative on [D-2](artifacts/implementation-decision-log.md#d-2-loader-surfaces-raw-file-content-under-the-existing-labels). +- **Reopen when:** a trial arm or a user report shows a chained skill misapplying raw content. +- **Source:** R1, test-engineer (TE-4) and software-architect (SA-1). + +### Retiring the 12 vendored `config-rule.md` copies + +- **Why deferred:** evidence test. The issue does not ask, and 34 citation lines would break. +- **Reopen when:** the next `config-rule.md` edit forces a 13-copy re-sync, or a copy drifts. +- **Source:** R1, software-architect (SA-8). + +### A SessionStart hook or fallback Read path for the 7 old-block skills + +- **Why deferred:** evidence test. With the D-21 edges, no installed skill is left without the loader. The only + remaining case is a vendored `han-plugin-builder` copy run without `han-core`, and no report shows one relying on + config ([D-22](artifacts/implementation-decision-log.md#d-22-vendored-plugin-builder-copies-carry-the-line-unchanged)). +- **Reopen when:** a consumer repo reports a vendored builder skill ignoring its config, or the maintainer declines the + dependency edges. +- **Source:** R1, software-architect deferred list. + +### A scoped `Skill(han-core:load-han-config)` permission rule + +- **Why deferred:** evidence test. No prompt has been observed. +- **Reopen when:** the INL-NOGRANT arm prompts and a blanket `Skill` grant is judged too broad. +- **Source:** R1, software-architect deferred list. + +### API-layer `api_retry` fault injection + +- **Why deferred:** evidence test. No harness can inject it, and the spike set the precedent of recording the gap. +- **Reopen when:** a user reports an inline early exit after shipping. +- **Source:** R1, test-engineer (S1). + +### A Skillwalker eval per rewired consumer + +- **Why deferred:** simpler-version test. One Bats guard asserts the line verbatim in every consumer. +- **Reopen when:** a consumer ships a non-canonical line. +- **Source:** R1, test-engineer (S2). + +### Running the trial under Codex + +- **Why deferred:** evidence test. Codex skill-to-skill behavior is undocumented. +- **Reopen when:** Codex documents skill invocation from a skill. +- **Source:** R1, test-engineer (S3). + +### Re-running the OI-3 standard-case arms + +- **Why deferred:** evidence test. Already measured at 34 of 34. +- **Reopen when:** the harness model changes. +- **Source:** R1, test-engineer (S4). + +### Bats guards for `Skill` grants, index completeness, and config-rule byte identity + +- **Why deferred:** evidence test. Grant enforcement is unknown, indexes are reviewed by hand per CLAUDE.md, and the + copies have not drifted. +- **Reopen when:** the INL-NOGRANT result shows the grant matters, a merged skill misses an index entry, or a copy + drifts, respectively. +- **Source:** R1, test-engineer (TE-6.6 to TE-6.8). + +### Widening property 2 to "a few values" in general + +- **Why deferred:** named anti-pattern, for-future-flexibility. One trial on one loader is evidence for one loader. The + bounded wording replaces it; see [D-16](artifacts/implementation-decision-log.md#d-16-guidance-corrections-and-bounded-widening). +- **Reopen when:** a second values sub-skill is validated by its own trial. +- **Source:** R1, junior-developer (JD-12) and software-architect (SA-11). + +## Open Items + +None of these blocks implementation. Each has a recommended answer already built into the plan. + +- **OI-1:** Does the maintainer hold unrecorded inline-failure evidence behind "unreliable in both forms", and which + skill and Claude Code version did the original coworker report involve? + - **Resolves when:** the maintainer replies on issue #203 with a transcript or a statement that none exists. + - **Blocks implementation:** No. Phase A says "untested", which stays true either way; evidence of an inline failure + would add a trial arm before Phase C. +- **OI-2:** Why did `origin/han-config-skill` stop? + - **Resolves when:** the maintainer names a reason. A technical reason not already covered by V9, V10, or V11 gets a + trial arm or a decision before Phase C. + - **Blocks implementation:** No. Its three recorded concerns are each handled here (D-8, D-12, D-1 with D-21). +- **OI-3:** How does the maintainer want this sequenced with PR #172? + - **Resolves when:** PR #172 no longer edits any SKILL.md, by rebase to the one-line script change, a split, merge, or + close. + - **Blocks implementation:** No for Phases A to C. Phase D waits on it by design + ([D-15](artifacts/implementation-decision-log.md#d-15-sequencing-with-pr-172)). +- **OI-4:** Does Codex run context-injection probes and let one skill invoke another? + - **Resolves when:** Codex documentation or a Codex session shows a Skill call from a skill completing with config + applied, or failing. + - **Blocks implementation:** No. 23 skills already rely on a Skill call to `readability-guidance` under Codex, so the + plan adds no new exposure class. Codex manifests carry no dependency field, so the D-21 edges do not apply there + either. + - Unverified: could not inspect Codex behavior, because nothing in the repository documents it and no Codex session + was available. +Other unverified inputs the plan carries, none of them blocking: + +- The Skill tool's response to an uninstalled skill name. It matters only for a vendored `han-plugin-builder` copy run + without `han-core` (D-22), where the intended result is a run with no configuration. Unverified: could not inspect it, + because no session without the target plugin installed was available. +- This run invoked a sub-skill without a `Skill` grant and was not prompted, but its permission mode is unrecorded. + INL-NOGRANT settles it. Unverified: could not inspect this run's permission mode, because it is not recorded. + +## Specialist Handoffs for Implementation + +- **`han-core:test-engineer`**: dispatch at the start of Phase B to build the harness, fixtures, and checker against the + pinned token and `.loads` grammars; needs this plan's trial subsection and `round-1-test-engineer.md`. Dispatch again + at Phase D for the count gate; needs the INL-NOGRANT branch taken. +- **`han-core:software-architect`**: dispatch if any trial arm other than SONNET-WORST fails, to re-scope Phases C and + D; needs the trial report. Dispatch also if the maintainer declines the dependency edges (RK-8), to restore the + `han-communication` placement; needs D-1's rejected alternatives. +- **`han-core:system-architect`**: dispatch only if the maintainer asks for a review of the five new dependency edges + before accepting them, or OI-4 shows Codex cannot run Skill calls; needs D-1, D-21, and the dependency-graph + measurements in `.discovery-notes.md`. + +## Sources and Plan Records + +- **Feature specification:** no source specification file. The plan was built from + [issue-203.md](issue-203.md), GitHub issue #203 verbatim plus the maintainer's comment, not from a `plan-a-feature` + spec. No spec decision log, team findings, or technical notes exist. +- **Recorded boundary:** [artifacts/scope-boundary.md](artifacts/scope-boundary.md) +- **Measurements and prior attempts:** [artifacts/.discovery-notes.md](artifacts/.discovery-notes.md) +- **Specialist reports (verbatim):** [test-engineer](artifacts/round-1-test-engineer.md), + [software-architect](artifacts/round-1-software-architect.md), + [junior-developer](artifacts/round-1-junior-developer.md) +- **YAGNI and scope ledger:** [artifacts/.yagni-ledger.md](artifacts/.yagni-ledger.md) +- **Decision rationale and rejected alternatives:** + [artifacts/implementation-decision-log.md](artifacts/implementation-decision-log.md) +- **Team composition and round-by-round history:** + [artifacts/implementation-iteration-history.md](artifacts/implementation-iteration-history.md) + +## Recommendation + +Ship as planned. Phase A can merge now. Phase B gates Phases C and D, and Phase D also waits for PR #172 to stop editing +SKILL.md files. The five new `han-core` dependency edges (D-21) are the item the maintainer may decline at review. If +that happens, the `han-communication` placement recorded in D-1's rejected alternatives returns, which differs by one +plugin folder and seven skills (RK-8). diff --git a/docs/plans/gh-203-consolidate-config-loading/issue-203.md b/docs/plans/gh-203-consolidate-config-loading/issue-203.md new file mode 100644 index 00000000..2f8565c0 --- /dev/null +++ b/docs/plans/gh-203-consolidate-config-loading/issue-203.md @@ -0,0 +1,143 @@ +# Issue #203: Consolidate config loading; the inline half of the data-fetch prohibition is unevidenced + +Source: https://github.com/testdouble/han/issues/203 (opened by @taminomara, state: open). Body copied verbatim as the specification for this plan. + +## Summary + +Every skill resolves `.han/config.md` for itself. When one skill invokes another, the caller's context ends up holding +several copies of the same config content and several copies of the same 65-word instruction to go read it. The obvious +fix is a shared config-loading skill, which `skill-composition.md` forbids. + +The evidence behind that prohibition is about `context: fork`. The inline case was measured 34 times and held. I would +like to correct the guidance, then consolidate. + +## The duplication + +44 of 47 skills carry the `project .han/config.md` probe, and 45 carry the instruction block after it. That block is 65 +words, so the suite carries about 2,900 words of identical instruction. + +Suite-wide duplication is not the problem, since a skill invoked on its own loads the block once. Chains are. A +`plan-a-feature` run that invokes `readability-guidance` and then `explanation-guidance` puts **three copies of the +config content and three of the instruction into one context window**, and copies two and three tell a model that has +already resolved the config to resolve it again. + +`context-hygiene.md:104`: + +> ### Rule: The attention cost is per-context, not per-file +> +> Copies compete for attention only when they load into the same context. + +That rule's carve-out is for content partitioned across sub-agent contexts that never co-reside. These co-reside. + +Only `readability-guidance` (24 callers), `explanation-guidance` (8), and the Atlassian orchestration targets are ever +invoked by another skill, so this is a five-skill problem rather than a 44-skill one. + +## The cost is already visible + +Per-skill config resolution has been rewritten three times: the original inline probe, #184's move to +`scripts/han-config-dir.sh` after the loader began refusing that probe, and #172, still open, adding `AGENT_CONFIG_DIR` +for Pi. Each pass edits 40-odd files to change one lookup. + +#172 shows the cost. Its central change: + +```diff +-- personal config directory: !`echo "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"` ++- personal config directory: !`echo "${AGENT_CONFIG_DIR:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}}"` +``` + +That edits the probe form #184 deleted twelve days later because the loader refuses it (#178), and replaces it with a +nested expansion, which is more of what the loader rejects. +`skill-building-guidance/context-injection-commands.md` now says to reach an environment variable through a script +rather than probe text. The PR is not wrong about anything; it predates the fix and has not been rebased. That is the +shape of the problem: one lookup, spread across 40-odd files, goes stale before it can land. + +Under a consolidated loader, #172's config half becomes one line inside `han-config-dir.sh`. Its Pi marketplace entries +and compat checks are unaffected. + +## Why the obvious fix is forbidden + +`skill-composition.md` classifies "a skill calls another skill just to retrieve a few values (config paths, a command, a +setting)" as data-fetch composition and says to avoid it. `troubleshooting.md:473` extends that to both forms: + +> ### Cause 1: Data-fetch sub-skill (forked or inline) +> +> This is unreliable in both forms. Inline, the model has no structured return mechanism and must manually +> context-switch back to the parent workflow. + +A shared config-reading sub-skill is the guidance's own example of the anti-pattern, so `/load-han-config` is exactly +what it says not to build. + +## What the evidence shows + +**The primary account is fork-only.** `writing-effective-instructions.md:145` is titled "Prefer inline discovery over +**forked** data-fetch sub-skills": + +> after a **forked** config-reading sub-skill returns "Not found: ...", an `api_retry` event can fire and the calling +> model treats the sub-skill's output as its final answer + +The failing pair was `code-review → read-project-config` across 7 skills, and the mechanism is `api_retry` anchoring +after `context: fork`. Every example in that section is a forked call. + +**The inline case was measured and held.** The OI-3 spike (`8c96157`): + +> Rigorous subagent-harness spike (46 trials, 4 arms): 34/34 same-context Skill-call invocations completed with zero +> early exits, including a worst-case adversarial arm. Forked `context:fork` disqualified because it isolates the +> guidance so its content never reaches the caller. + +Fork failed for the opposite reason to the one the prohibition describes: its content never reaches the caller at all. + +**So "unreliable in both forms" is assertion.** "Inline, the model has no structured return mechanism" does not describe +the mechanism. An inline sub-skill renders into the shared context, and whatever it resolved is simply there. That is +how `readability-guidance` already works. + +`skill-composition.md:121`'s exception requires "a whole standard, not a few values." That boundary looks drawn around +the case the spike happened to run rather than around a failure mode; the property carrying the evidence is inline +rather than forked. + +I am not claiming the values case is proven. The spike surfaced a standard, and nobody has run the same trial on +resolved values. That gap is untested, not known-broken. + +## Proposal + +1. Correct `troubleshooting.md:473` to match the evidence, or attach evidence I did not find. +2. Run an OI-3-shaped trial on the values case, with a worst-case arm. +3. If it holds, add `load-han-config` to `han-core`, beside `project-discovery`, already the precedent for + machine-written, skill-consumed project context. +4. Cut each consuming skill's block to one line: "Resolve configuration with `han-core:load-han-config` if you have not + already this run." The idempotence hint keeps a chain resolving once. +5. Widen property 2 of the exception to match the trial. + +Step 1 stands regardless, since the guidance currently contradicts its own spike. + +## Open questions + +- **Is there inline-failure evidence I missed?** I searched the guidance, the OI-3 artifacts, and the commit history + and found only the forked account. If "both forms" came from an unrecorded observation, that changes the answer and + is worth writing down. +- **Does the personal-config Read survive consolidation?** The personal file is read with the Read tool rather than a + probe, deliberately, because a probe cannot prompt or degrade. A consolidating skill would own that read, which seems + fine, but it moves a decision `config-rule.md` currently pins per skill. +- **Is one line enough when a skill is invoked directly?** `load-han-config` has to be discoverable from that line + alone. +- **How should this sequence with #172?** It needs rebasing onto #184 either way. Consolidating first makes its config + half a one-line change; not consolidating means it rebases and lands on its own. Either order works, but they should + not run in parallel against the same 40-odd files. + +## Before I start + +@mxriverlynn happy to do this, including the trial, if you have no objections. Flagging rather than starting because it +touches every skill, and because step 1 corrects guidance you wrote, so you may have context on the "both forms" +wording that is not in the repo. + +@kadams54 flagging you for #172. Nothing here blocks it and the Pi work stands on its own; the note is only that its +config half sits on a probe form #184 removed, so it needs a rebase regardless. + + +## Comments + +**@mxriverlynn** (2026-09-11T16:36:50Z): + +@taminomara would love to have you digging into this! the original report of skills failing because of the config loading, came from a coworker. the current version that copies the same load command everywhere "works" and was a good enough solution. for long term maintenance, i definitely want a better solution. i don't like having everything trying to load the config file when it's already loaded, but had not been able to dig further into this. + +are there any specific questions you want me to dig into or answer? + diff --git a/docs/skills/README.md b/docs/skills/README.md index 452ee758..c561beba 100644 --- a/docs/skills/README.md +++ b/docs/skills/README.md @@ -59,6 +59,8 @@ skill-and-agent split is fuzzy, read [Concepts](../concepts.md) first. information, assess severity and reproducibility, and recommend the right next skill to run. - [`/iterative-plan-review`](../../han-planning/docs/skills/iterative-plan-review.md) — Stress-test an already-written plan through multiple codebase-grounded review passes. +- [`/load-han-config`](../../han-core/docs/skills/load-han-config.md) — Bring both `.han/config.md` files into the + calling skill's context once per run, so a chain of skills reads the configuration once instead of once per skill. - [`/manual-test-planning`](../../han-coding/docs/skills/manual-test-planning.md) — Produce a plain-language manual test plan from supplied context: named tests with by-hand steps and expected outcomes for a person to run. - [`/markdown-to-confluence`](../../han-atlassian/docs/skills/markdown-to-confluence.md) — Publish one local Markdown diff --git a/evals/load-han-config/prompts/skill-call-load-han-config.md b/evals/load-han-config/prompts/skill-call-load-han-config.md new file mode 100644 index 00000000..12a6a8f9 --- /dev/null +++ b/evals/load-han-config/prompts/skill-call-load-han-config.md @@ -0,0 +1 @@ +Run load-han-config and tell me which Han configuration files this run found and what they set. diff --git a/evals/load-han-config/scaffolds/project-with-config/.han/config.md b/evals/load-han-config/scaffolds/project-with-config/.han/config.md new file mode 100644 index 00000000..329a9008 --- /dev/null +++ b/evals/load-han-config/scaffolds/project-with-config/.han/config.md @@ -0,0 +1,4 @@ +--- +output-directory: docs/han-output +default-swarm-size: large +--- diff --git a/evals/load-han-config/tests.json b/evals/load-han-config/tests.json new file mode 100644 index 00000000..cf5df8f3 --- /dev/null +++ b/evals/load-han-config/tests.json @@ -0,0 +1,14 @@ +{ + "plugins": ["han-core"], + "tests": [ + { + "name": "Skill Call: /load-han-config reports the project file", + "type": "skill-call", + "model": "opus", + "skillFile": "han-core:load-han-config", + "promptFile": "skill-call-load-han-config.md", + "scaffold": "project-with-config", + "expect": [{ "skill-call": true }, { "result-contains": "docs/han-output" }, { "result-contains": "large" }] + } + ] +} diff --git a/han-atlassian/references/config-rule.md b/han-atlassian/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-atlassian/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-atlassian/scripts/han-config-dir.sh b/han-atlassian/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-atlassian/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-atlassian/skills/code-overview-to-confluence/SKILL.md b/han-atlassian/skills/code-overview-to-confluence/SKILL.md index 32c4f00e..8d590fcc 100644 --- a/han-atlassian/skills/code-overview-to-confluence/SKILL.md +++ b/han-atlassian/skills/code-overview-to-confluence/SKILL.md @@ -13,19 +13,12 @@ argument-hint: "[size: small | medium | large] [target: file, directory, symbol, or PR reference — defaults to the current branch's changes] [confluence location: page URL or space + parent] [--mode draft|live (default draft)]" allowed-tools: - Read, Glob, Grep, Skill, Agent, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Read, Glob, Grep, Skill, Agent, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Code Overview to Confluence @@ -77,7 +70,7 @@ the relevant conversation context. Do not summarize, trim, or reinterpret the us **except** add one explicit instruction: it must write the overview to an explicit scratch path this skill names (for example `${TMPDIR:-/tmp}/code-overview-.md`). Passing the path explicitly keeps the file where this skill expects it even when either `.han/config.md` configures an output directory, because explicit input outranks the config -(see [../../references/config-rule.md](../../references/config-rule.md)). **Capture the exact scratch-file path it +(see the config rule `han-core:load-han-config` surfaced). **Capture the exact scratch-file path it wrote.** That markdown file is the source content for Confluence. Proceed to Step 3 once it finishes. ## Step 3: Show the File for Review diff --git a/han-atlassian/skills/investigate-to-confluence/SKILL.md b/han-atlassian/skills/investigate-to-confluence/SKILL.md index 023fa847..3a7182ae 100644 --- a/han-atlassian/skills/investigate-to-confluence/SKILL.md +++ b/han-atlassian/skills/investigate-to-confluence/SKILL.md @@ -12,19 +12,12 @@ argument-hint: "[symptom or question to investigate] [confluence location: page URL or space + parent] [--mode draft|live (default draft)]" allowed-tools: - Read, Glob, Grep, Skill, Agent, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Read, Glob, Grep, Skill, Agent, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Investigate to Confluence @@ -75,7 +68,7 @@ adversarial validation, and the final report) — **except** add two explicit in - It must write the resulting investigation report to a file under `/tmp/` (for example `/tmp/.md`) rather than into the project's docs or plans directory. This keeps the working report out of the repo until the user decides to publish it, and because the path is explicit input it outranks any `output-directory` the project or personal - `.han/config.md` supplies (see [../../references/config-rule.md](../../references/config-rule.md)). + `.han/config.md` supplies (see the config rule `han-core:load-han-config` surfaced). - It must **stop after producing the report**. `han-coding:investigate` normally ends by presenting the plan for approval and can trigger the fix's implementation on approval; this skill wants the report only, so instruct it not to implement the fix or change any code — this skill publishes findings, it does not ship them. diff --git a/han-atlassian/skills/markdown-to-confluence/SKILL.md b/han-atlassian/skills/markdown-to-confluence/SKILL.md index fb54edf9..c040310f 100644 --- a/han-atlassian/skills/markdown-to-confluence/SKILL.md +++ b/han-atlassian/skills/markdown-to-confluence/SKILL.md @@ -9,23 +9,16 @@ description: > argument-hint: "[path to markdown file] [confluence location: page URL or space + parent] [--mode draft|live (default draft)]" allowed-tools: - Read, Glob, Grep, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, + Skill, Read, Glob, Grep, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, mcp__claude_ai_Atlassian__atlassianUserInfo, mcp__claude_ai_Atlassian__getConfluenceSpaces, mcp__claude_ai_Atlassian__getConfluencePage, mcp__claude_ai_Atlassian__getPagesInConfluenceSpace, mcp__claude_ai_Atlassian__getConfluencePageDescendants, mcp__claude_ai_Atlassian__createConfluencePage, - mcp__claude_ai_Atlassian__updateConfluencePage, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + mcp__claude_ai_Atlassian__updateConfluencePage --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Markdown to Confluence diff --git a/han-atlassian/skills/plan-a-feature-to-confluence/SKILL.md b/han-atlassian/skills/plan-a-feature-to-confluence/SKILL.md index 5127d8ae..1cf91736 100644 --- a/han-atlassian/skills/plan-a-feature-to-confluence/SKILL.md +++ b/han-atlassian/skills/plan-a-feature-to-confluence/SKILL.md @@ -13,19 +13,12 @@ argument-hint: "[size: small | medium | large] [feature description] [confluence location: page URL or space + parent] [--mode draft|live (default draft)]" allowed-tools: - Read, Write, Edit, Glob, Grep, Skill, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Read, Write, Edit, Glob, Grep, Skill, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Plan a Feature to Confluence @@ -80,7 +73,7 @@ folder under `/tmp/` (for example `/tmp//`) rather than into the r prompt the user to choose or confirm an output location, because this skill owns that decision. This keeps the working plan out of the repo until the user decides to publish it, and because the path is explicit input it outranks any `output-directory` the project or personal `.han/config.md` supplies (see -[../../references/config-rule.md](../../references/config-rule.md)). +the config rule `han-core:load-han-config` surfaced). Let `han-planning:plan-a-feature` complete its full process. **Capture the exact `/tmp/` paths of every file it wrote:** diff --git a/han-atlassian/skills/project-documentation-to-confluence/SKILL.md b/han-atlassian/skills/project-documentation-to-confluence/SKILL.md index 141ddc86..8e4fb7da 100644 --- a/han-atlassian/skills/project-documentation-to-confluence/SKILL.md +++ b/han-atlassian/skills/project-documentation-to-confluence/SKILL.md @@ -12,19 +12,12 @@ description: > argument-hint: "[feature-name or doc-path] [confluence location: page URL or space + parent]" allowed-tools: Read, Glob, Grep, Skill, Agent, Bash(date *), Bash(git config *), Bash(whoami), Bash(mkdir *), Bash(find *), - mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + mcp__claude_ai_Atlassian__getAccessibleAtlassianResources --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Project Documentation to Confluence @@ -65,7 +58,7 @@ as it would on its own — **except** add one explicit instruction: it must writ under `/tmp/` (for example `/tmp/.md`) rather than into the project's docs directory. This keeps the working draft out of the repo until the user decides to publish it, and because the path is explicit input it outranks any `output-directory` the project or personal `.han/config.md` supplies (see -[../../references/config-rule.md](../../references/config-rule.md)). +the config rule `han-core:load-han-config` surfaced). Let `han-documentation:project-documentation` complete its full process (codebase exploration, writing the doc, content audit, information-architecture review, and verification). **Capture the exact `/tmp/` file path it wrote.** That markdown file diff --git a/han-atlassian/skills/work-items-to-jira/SKILL.md b/han-atlassian/skills/work-items-to-jira/SKILL.md index 249125da..4f7028fc 100644 --- a/han-atlassian/skills/work-items-to-jira/SKILL.md +++ b/han-atlassian/skills/work-items-to-jira/SKILL.md @@ -11,24 +11,17 @@ argument-hint: deprecated alias)] [--type issue type, default Story] [--assignee accountId or email (optional)] [--column name, default Backlog]" allowed-tools: - Read, Write, Edit, Glob, Grep, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, + Skill, Read, Write, Edit, Glob, Grep, Bash(find *), mcp__claude_ai_Atlassian__getAccessibleAtlassianResources, mcp__claude_ai_Atlassian__atlassianUserInfo, mcp__claude_ai_Atlassian__getVisibleJiraProjects, mcp__claude_ai_Atlassian__getJiraProjectIssueTypesMetadata, mcp__claude_ai_Atlassian__lookupJiraAccountId, mcp__claude_ai_Atlassian__createJiraIssue, mcp__claude_ai_Atlassian__editJiraIssue, mcp__claude_ai_Atlassian__getJiraIssue, mcp__claude_ai_Atlassian__getTransitionsForJiraIssue, - mcp__claude_ai_Atlassian__transitionJiraIssue, mcp__claude_ai_Atlassian__searchJiraIssuesUsingJql, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + mcp__claude_ai_Atlassian__transitionJiraIssue, mcp__claude_ai_Atlassian__searchJiraIssuesUsingJql --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Work Items to Jira Tickets diff --git a/han-coding/references/config-rule.md b/han-coding/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-coding/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-coding/scripts/han-config-dir.sh b/han-coding/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-coding/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-coding/skills/architectural-analysis/SKILL.md b/han-coding/skills/architectural-analysis/SKILL.md index 2c43595a..784b3ebc 100644 --- a/han-coding/skills/architectural-analysis/SKILL.md +++ b/han-coding/skills/architectural-analysis/SKILL.md @@ -12,7 +12,7 @@ description: writing documentation or architectural decision records." arguments: size argument-hint: "[size: small | medium | large | dynamic] [focus area: module, directory, or feature to analyze]" -allowed-tools: Read, Glob, Grep, Agent, Bash(find *), Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read, Glob, Grep, Agent, Bash(find *) --- ## Project Context @@ -20,13 +20,8 @@ allowed-tools: Read, Glob, Grep, Agent, Bash(find *), Bash(bash "${CLAUDE_PLUGIN - git installed: !`which git 2>/dev/null || echo "not installed"` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -124,7 +119,7 @@ borderline, stay at the smaller band. **Apply the size override.** If `$size` is not `none provided`, use it: a band value is the band and skips the signal-based classification above, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is `none provided` and the project config supplies a band via `default-swarm-size` -(per the config rule in [../../references/config-rule.md](../../references/config-rule.md)), use that band, skip the +(per the config rule `han-core:load-han-config` surfaced), use that band, skip the signal-based classification, and announce the config as the source. In every case still select specialists by signal (a `large` band does not dispatch agents whose domain the code never touches). A conversational override ("run this large") is equivalent to `$size`. @@ -171,7 +166,7 @@ telemetry pipeline configuration, or signal choice. SLO definitions, alert rules stay with `han-core:on-call-engineer`. Extra agents named in the project config's `## Extra Agents` list join the signal-selected specialist pool and compete -under the same signals and band caps, per [../../references/config-rule.md](../../references/config-rule.md): add one +under the same signals and band caps, per the config rule `han-core:load-han-config` surfaced: add one only when a signal in the focus area matches its stated specialty, count it against the band's cap, and skip an entry that does not resolve to a dispatchable agent with a one-line note. diff --git a/han-coding/skills/automated-test-planning/SKILL.md b/han-coding/skills/automated-test-planning/SKILL.md index b9b4062d..bd608e1d 100644 --- a/han-coding/skills/automated-test-planning/SKILL.md +++ b/han-coding/skills/automated-test-planning/SKILL.md @@ -11,8 +11,7 @@ description: > arguments: size argument-hint: "[size: small | medium | large | dynamic] [optional: file paths, directories, or description of what to test]" allowed-tools: - Bash(git *), Bash(find *), Read, Grep, Glob, Agent, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Bash(git *), Bash(find *), Read, Grep, Glob, Agent --- ## Operating Principles @@ -46,13 +45,8 @@ allowed-tools: - git installed: !`which git 2>/dev/null || echo "not installed"` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Step 1: Determine Scope @@ -108,7 +102,7 @@ changed-files list whenever the user named no scope, and that list describes the **Size override.** If `$size` is non-empty (the user passed `small`, `medium`, `large`, or `dynamic` as the first argument), use it: a band value is the size and skips the signal-based classification above, while `dynamic` forces the signal-based classification even when the config sets a default band. If `$size` is empty and either `.han/config.md` -supplies a band via `default-swarm-size` (per [../../references/config-rule.md](../../references/config-rule.md)), use +supplies a band via `default-swarm-size` (per the config rule `han-core:load-han-config` surfaced), use that band and skip the signal-based classification. Anything that is not one of the four accepted values is trailing context, not a size. @@ -178,7 +172,7 @@ apply. {any additional context from user arguments}" Extra agents named in the project config's `## Extra Agents` list join this conditional-dispatch pool under the same -file-list-signal selection, per [../../references/config-rule.md](../../references/config-rule.md): dispatch one only +file-list-signal selection, per the config rule `han-core:load-han-config` surfaced: dispatch one only when the file list carries a signal matching its stated specialty, and skip an entry that does not resolve to a dispatchable agent with a one-line note. diff --git a/han-coding/skills/code-overview/SKILL.md b/han-coding/skills/code-overview/SKILL.md index 4cac7b47..01e51efb 100644 --- a/han-coding/skills/code-overview/SKILL.md +++ b/han-coding/skills/code-overview/SKILL.md @@ -15,8 +15,7 @@ argument-hint: "[size: small | medium | large | dynamic] [target: file, directory, symbol, or PR reference — defaults to the current branch's changes]" allowed-tools: - Read, Glob, Grep, Agent, Write, Bash(git *), Bash(gh *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Glob, Grep, Agent, Write, Bash(git *), Bash(gh *), Bash(find *) --- ## Project Context @@ -25,13 +24,8 @@ allowed-tools: - gh installed: !`which gh 2>/dev/null || echo "not installed"` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -150,7 +144,7 @@ signal is borderline. **Apply the size override.** If `$size` is not `none provided`, use it: a band value is the band and skips the signal-based classification, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is `none provided` and the project config supplies a band via `default-swarm-size` (per the -config rule in [../../references/config-rule.md](../../references/config-rule.md)), use that band, skip the +config rule `han-core:load-han-config` surfaced), use that band, skip the signal-based classification, and name the config as the source in the announcement below. A conversational override ("give me a large overview") is equivalent. @@ -314,7 +308,7 @@ The file is named `code-overview-{short-target-slug}.md` wherever it lands. Only beneath it. Honor it even when it points inside the repository, and say nothing about that, BECAUSE the person who configured a destination chose it, and this skill's own default is not a veto over their choice. Relative-path resolution, `~` expansion, and precedence between the personal and project files are governed by - [config-rule.md](../../references/config-rule.md); do not re-derive them here. + the config rule `han-core:load-han-config` surfaced; do not re-derive them here. 2. **No configured value.** Write outside the repository — for example `${TMPDIR:-/tmp}/code-overview-{short-target-slug}.md` — BECAUSE an unconfigured overview is an orientation aid rather than documentation, and a default inside the repository would land it in a commit sooner or later. diff --git a/han-coding/skills/code-review/SKILL.md b/han-coding/skills/code-review/SKILL.md index 657ed312..a79a918f 100644 --- a/han-coding/skills/code-review/SKILL.md +++ b/han-coding/skills/code-review/SKILL.md @@ -14,8 +14,7 @@ argument-hint: "[type: security | testing | architecture | data | observability | resilience | release | maintainability | docs | ux | work-ticket | a type from .han/config.md] [focus areas, or file paths in Mode C]" allowed-tools: - Bash(git *), Bash(gh *), Bash(make *), Bash(npm *), Read, Write, Grep, Glob, Agent, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Bash(git *), Bash(gh *), Bash(make *), Bash(npm *), Read, Write, Grep, Glob, Agent --- When running a code review, follow the process outlined here. @@ -25,13 +24,8 @@ When running a code review, follow the process outlined here. - git installed: !`which git 2>/dev/null || echo "not installed"` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Review Constraints @@ -155,7 +149,7 @@ skips it in Mode B and Mode C unless the user asks for it. ### Review types and agents from `.han/config.md` A team declares review types Han does not ship, and attaches its own agents to any type, in either config file read at -the top of this skill. [config-rule.md](../../references/config-rule.md) governs path resolution and which file wins; +the top of this skill. The config rule `han-core:load-han-config` surfaced governs path resolution and which file wins; the line formats and how this skill uses them are defined here. ```markdown @@ -417,7 +411,7 @@ Name the run before anything is dispatched, so every agent's output is filed in 1. **A configured `output-directory`.** When the config read at the top of this skill supplied one, use it. Relative-path resolution, `~` expansion, and precedence between the personal and project files are governed by - [config-rule.md](../../references/config-rule.md); do not re-derive them here. + the config rule `han-core:load-han-config` surfaced; do not re-derive them here. 2. **No configured value.** Use the project's existing documentation folder (e.g., `docs/`) when there is one, and the current working directory otherwise. This is also the fallback Step 8.6 uses when the first destination cannot be written. diff --git a/han-coding/skills/code-review/references/agent-dispatch.md b/han-coding/skills/code-review/references/agent-dispatch.md index 82ab2391..95da17ac 100644 --- a/han-coding/skills/code-review/references/agent-dispatch.md +++ b/han-coding/skills/code-review/references/agent-dispatch.md @@ -61,7 +61,7 @@ type files and SKILL.md's `## Review Types` section say which agents run. - Honor any agent the user named explicitly. - On the default run only, extra agents named in the config's `## Extra Agents` list, and agents attached to a default-set type, join this candidate pool and compete under the same signal-based selection as the roster above, - per [../../references/config-rule.md](../../../references/config-rule.md): include one only when a signal in the + per the config rule `han-core:load-han-config` surfaced: include one only when a signal in the file list matches its stated specialty, justify the inclusion in one line, and skip an entry that does not resolve to a dispatchable agent with a one-line note. A typed run does not consider `## Extra Agents` and says nothing about it. diff --git a/han-coding/skills/code-walkthrough/SKILL.md b/han-coding/skills/code-walkthrough/SKILL.md index 5bf2a341..9915ccbd 100644 --- a/han-coding/skills/code-walkthrough/SKILL.md +++ b/han-coding/skills/code-walkthrough/SKILL.md @@ -14,8 +14,7 @@ argument-hint: "[size: small | medium | large | dynamic] [target: a file, directory, symbol, PR reference, or plan — defaults to the current branch's changes]" allowed-tools: - Read, Glob, Grep, Agent, Bash(git *), Bash(gh *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Glob, Grep, Agent, Bash(git *), Bash(gh *), Bash(find *) --- ## Project Context @@ -27,13 +26,8 @@ allowed-tools: - repository root: !`git rev-parse --show-toplevel 2>/dev/null || pwd` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -130,7 +124,7 @@ exists, note that surrounding-code inference applies and pass that into the brie **Apply the size override.** If `$size` is not `none provided`, use it: a band value is the band and skips the signal-based classification, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is `none provided` and the project config supplies a band via `default-swarm-size` (per -[../../references/config-rule.md](../../references/config-rule.md)), use that band and name the config as the source in +the config rule `han-core:load-han-config` surfaced), use that band and name the config as the source in Step 3's announcement. A conversational override ("walk me through it in detail") is equivalent. **Gather the input.** For a branch or pull request, capture the change set and its intent: diff --git a/han-coding/skills/coding-standard/SKILL.md b/han-coding/skills/coding-standard/SKILL.md index 58947d46..b75f3ba8 100644 --- a/han-coding/skills/coding-standard/SKILL.md +++ b/han-coding/skills/coding-standard/SKILL.md @@ -8,8 +8,7 @@ description: > not produce runbooks for operational scenarios — use runbook for that. argument-hint: "[standard-topic or document-path]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(mkdir *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(mkdir *), Bash(find *) --- ## Project Context @@ -18,13 +17,8 @@ allowed-tools: - AGENTS.md: !`find . -maxdepth 1 -name "AGENTS.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` - Rules directory: !`find . -maxdepth 4 -type d -path "*/.claude/rules/coding-standards"` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Step 1: Determine Mode diff --git a/han-coding/skills/design-an-api/SKILL.md b/han-coding/skills/design-an-api/SKILL.md index 24eddfa2..5c485675 100644 --- a/han-coding/skills/design-an-api/SKILL.md +++ b/han-coding/skills/design-an-api/SKILL.md @@ -14,8 +14,7 @@ arguments: size argument-hint: "[size: small | medium | large | dynamic] [the goal or ticket this serves, and the interface to design]" allowed-tools: - Read, Write, Glob, Grep, Agent, Bash(git *), Bash(find *), Bash(mkdir *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Glob, Grep, Agent, Bash(git *), Bash(find *), Bash(mkdir *) --- ## Project Context @@ -25,13 +24,8 @@ allowed-tools: - default branch: !`git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || echo unknown` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -111,7 +105,7 @@ and `{folder}/api-design.md`. Resolve `{folder}` in this order: 1. If the user specified an output folder, use it. 2. If the project or personal config sets an `output-directory`, place the run folder under it, per - [config-rule.md](../../references/config-rule.md). + the config rule `han-core:load-han-config` surfaced. 3. Otherwise, choose a 2-to-4-word kebab-case folder named for the interface, under a documentation root surfaced via `CLAUDE.md`, `project-discovery.md`, or a Glob fallback (`docs/plans/`, `docs/`). @@ -154,7 +148,7 @@ borderline, stay at the smaller band. **Apply the size override.** If `$size` is not `none provided`, use it: a band value is the band and skips the signal-based classification above, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is `none provided` and the project config supplies a band via `default-swarm-size` (per -[config-rule.md](../../references/config-rule.md)), use that band, skip the signal-based classification, and announce +the config rule `han-core:load-han-config` surfaced), use that band, skip the signal-based classification, and announce the config as the source. In every case still select specialists by signal: a `large` band does not dispatch agents whose domain the contract never touches. A conversational override ("design this large") is equivalent to `$size`. @@ -188,7 +182,7 @@ allows, keep the band's count, prefer the specialists covering the strongest sig the design document's summary so the user can re-run larger. Extra agents named in the project config's `## Extra Agents` list join the signal-selected pool and compete under the -same signals and band caps, per [config-rule.md](../../references/config-rule.md): add one only when a signal in the +same signals and band caps, per the config rule `han-core:load-han-config` surfaced: add one only when a signal in the interface matches its stated specialty, count it against the band's cap, and skip an entry that does not resolve to a dispatchable agent with a one-line note. diff --git a/han-coding/skills/investigate/SKILL.md b/han-coding/skills/investigate/SKILL.md index dd2056a4..0798f1b8 100644 --- a/han-coding/skills/investigate/SKILL.md +++ b/han-coding/skills/investigate/SKILL.md @@ -10,20 +10,15 @@ description: > calls for — use plan-a-change. Does not map bounded contexts or domain boundaries — use ddd-analysis. Does not capture feedback on Han's own skills — use han-feedback for that. argument-hint: "[symptom or problem description, and optionally an output path]" -allowed-tools: Read, Glob, Grep, Agent, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read, Glob, Grep, Agent --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Investigation Approach @@ -81,7 +76,7 @@ every applicable specialist in parallel with the `han-core:evidence-based-invest numbered findings keyed to file paths, line numbers, and schema or migration references." Extra agents named in the project config's `## Extra Agents` list join this conditional-specialist pool under the same -symptom-driven selection, per [../../references/config-rule.md](../../references/config-rule.md): dispatch one only +symptom-driven selection, per the config rule `han-core:load-han-config` surfaced: dispatch one only when the classified bug type matches its stated specialty, and skip an entry that does not resolve to a dispatchable agent with a one-line note. diff --git a/han-coding/skills/manual-test-planning/SKILL.md b/han-coding/skills/manual-test-planning/SKILL.md index d6927919..ad484fbf 100644 --- a/han-coding/skills/manual-test-planning/SKILL.md +++ b/han-coding/skills/manual-test-planning/SKILL.md @@ -11,18 +11,12 @@ description: > not analyze code for automated test coverage gaps — use automated-test-planning. Does not write test code — use tdd. Does not review code quality — use code-review. Does not stress-test an existing plan — use iterative-plan-review. argument-hint: "[optional: files, a branch, a plan, a PR, or a description of what to manually test]" -allowed-tools: Bash(git *), Read, Grep, Glob, Write, Agent, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Bash(git *), Read, Grep, Glob, Write, Agent --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles diff --git a/han-coding/skills/refactor/SKILL.md b/han-coding/skills/refactor/SKILL.md index 8631c5e3..2c8402ed 100644 --- a/han-coding/skills/refactor/SKILL.md +++ b/han-coding/skills/refactor/SKILL.md @@ -13,9 +13,8 @@ description: > refactoring as it lands, use pairing. argument-hint: "[file, module, named smell, or a path to review findings]" allowed-tools: - Read, Write, Edit, Glob, Grep, Bash(git *), Bash(find *), Bash(npm *), Bash(npx *), Bash(pnpm *), Bash(yarn *), - Bash(pytest *), Bash(python3 *), Bash(go *), Bash(cargo *), Bash(make *), Bash(bundle *), Bash(rake *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Bash(git *), Bash(find *), Bash(npm *), Bash(npx *), Bash(pnpm *), Bash(yarn *), + Bash(pytest *), Bash(python3 *), Bash(go *), Bash(cargo *), Bash(make *), Bash(bundle *), Bash(rake *) --- ## Project Context @@ -25,13 +24,8 @@ allowed-tools: - working tree: !`git status --porcelain 2>/dev/null | head -5` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Constraints (read before anything else) diff --git a/han-coding/skills/restructure/SKILL.md b/han-coding/skills/restructure/SKILL.md index 93e7646c..bf3f1daf 100644 --- a/han-coding/skills/restructure/SKILL.md +++ b/han-coding/skills/restructure/SKILL.md @@ -15,8 +15,7 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Skill, Bash(git *), Bash(find *), Bash(mkdir *), Bash(date *), Bash(npm *), Bash(npx *), Bash(pnpm *), Bash(yarn *), Bash(bun *), Bash(pytest *), Bash(python3 *), Bash(go *), Bash(cargo *), Bash(make *), Bash(bundle *), Bash(rake *), Bash(bash "${CLAUDE_SKILL_DIR}/scripts/undo-attempt.sh" *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/skills/refactor/scripts/detect-refactor-context.sh"), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Bash(bash "${CLAUDE_PLUGIN_ROOT}/skills/refactor/scripts/detect-refactor-context.sh") --- ## Project Context @@ -27,13 +26,8 @@ allowed-tools: - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - AGENTS.md: !`find . -maxdepth 1 -name "AGENTS.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Constraints (read before anything else) @@ -108,7 +102,7 @@ Grep that should return nothing when the goal is met, or a boundary test from th count. The plan in Step 6 and the finish in Step 10 both read it. **Resolve the output location** through the precedence chain in -[config-rule.md](../../references/config-rule.md): a folder the person named wins; otherwise the `output-directory` +the config rule `han-core:load-han-config` surfaced: a folder the person named wins; otherwise the `output-directory` setting with the run's own folder beneath it; otherwise a folder under the documentation root discovered above, or `docs/changes/` when none is found. Name the run's folder `restructure-{date}` from `date +%Y-%m-%d`, appending `-2`, `-3`, and so on until the name is unused. Call it `{folder}`. diff --git a/han-coding/skills/tdd/SKILL.md b/han-coding/skills/tdd/SKILL.md index 181ce20c..002854ea 100644 --- a/han-coding/skills/tdd/SKILL.md +++ b/han-coding/skills/tdd/SKILL.md @@ -13,9 +13,8 @@ description: > completion without pausing for review; to review each behavior as it lands, use pairing. argument-hint: "[what to build, a behavior to drive, or a path to a spec/plan]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(git *), Bash(find *), Bash(npm *), Bash(npx *), Bash(pnpm *), Bash(yarn *), - Bash(pytest *), Bash(python3 *), Bash(go *), Bash(cargo *), Bash(make *), Bash(bundle *), Bash(rake *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(git *), Bash(find *), Bash(npm *), Bash(npx *), Bash(pnpm *), Bash(yarn *), + Bash(pytest *), Bash(python3 *), Bash(go *), Bash(cargo *), Bash(make *), Bash(bundle *), Bash(rake *) --- ## Project Context @@ -24,13 +23,8 @@ allowed-tools: - current branch: !`git branch --show-current 2>/dev/null || echo unknown` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Constraints (read before anything else) diff --git a/han-communication/.claude-plugin/plugin.json b/han-communication/.claude-plugin/plugin.json index 94743d4a..f9fb650b 100644 --- a/han-communication/.claude-plugin/plugin.json +++ b/han-communication/.claude-plugin/plugin.json @@ -1,5 +1,6 @@ { "name": "han-communication", - "description": "Foundational communication plugin for the Han suite. Owns the canonical readability standard, the writing-voice profile, and the explanation standard for talking to a reader who will not implement the work, plus the readability-guidance skill that surfaces the first two into a calling skill's own context for in-voice drafting, the explanation-guidance skill that surfaces the third at the point a run talks to a person, the readability-editor agent that runs the adversarial rewrite over a finished draft, and the edit-for-readability skill that applies that rewrite on demand. Depends on nothing and sits beneath every other plugin; the plugins that produce prose output depend on it.", - "version": "1.2.1" + "description": "Foundational communication plugin for the Han suite. Owns the canonical readability standard, the writing-voice profile, and the explanation standard for talking to a reader who will not implement the work, plus the readability-guidance skill that surfaces the first two into a calling skill's own context for in-voice drafting, the explanation-guidance skill that surfaces the third at the point a run talks to a person, the readability-editor agent that runs the adversarial rewrite over a finished draft, and the edit-for-readability skill that applies that rewrite on demand. Depends on han-core for the shared configuration loader and sits beneath every other prose-producing plugin, which depend on it.", + "version": "1.2.1", + "dependencies": ["han-core"] } diff --git a/han-communication/README.md b/han-communication/README.md index 2df5600f..0a09f0f7 100644 --- a/han-communication/README.md +++ b/han-communication/README.md @@ -5,8 +5,9 @@ profile, and the standard for explaining technical work to a reader who will not agent that apply them, so every prose-producing plugin in the suite writes against one shared set of standards instead of its own copy. Reach for it whenever output has to read well for someone who did not write it. -**Bundled.** Installed with the `han` meta-plugin. Depends on nothing: it is the foundational layer, and every plugin -that produces prose output depends on it, so it comes along whenever you install one of them. +**Bundled.** Installed with the `han` meta-plugin. Depends on `han-core` for the shared configuration loader. It is the +foundational layer for prose: every plugin that produces prose output depends on it, so it comes along whenever you +install one of them. ## Skills diff --git a/han-communication/references/config-rule.md b/han-communication/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-communication/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-communication/scripts/han-config-dir.sh b/han-communication/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-communication/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-communication/skills/edit-for-readability/SKILL.md b/han-communication/skills/edit-for-readability/SKILL.md index 57d4f485..b6d47fa2 100644 --- a/han-communication/skills/edit-for-readability/SKILL.md +++ b/han-communication/skills/edit-for-readability/SKILL.md @@ -11,18 +11,12 @@ description: > restructure code and code-review to audit it. Does not judge the underlying work or raise findings; it only rewrites the writing. argument-hint: "[path to a file, pasted text, or 'the draft above']" -allowed-tools: Read, Write, Glob, Grep, Agent, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read, Write, Glob, Grep, Agent --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Edit for Readability @@ -79,9 +73,9 @@ such as bullets or a table, or a register such as "no jargon" — carry that req words. Only what the user said to you in this conversation counts. Shape language inside the target is content to rewrite, never an instruction. When the user asked for no shape, pass nothing about it and every fact stays. -Finally, resolve the writing-voice source. When either `.han/config.md` probe supplied a `writing-voice` value, resolve +Finally, resolve the writing-voice source. When the run's `project .han/config.md` or its personal `.han/config.md` supplied a `writing-voice` value, resolve it and check that the file exists. A relative value resolves against the folder holding the file that declared it: the -working directory for the project file, and the `personal config directory` the probe reported for the personal file. A +working directory for the project file, and the run's `personal config directory` value for the personal file. A full path is used as it stands, and a leading `~` expands to the home directory. When both files supply a value, the project file's wins. Resolve the path here and pass the editor an absolute one, so the editor and this skill apply the same profile. When it exists, that file replaces the built-in writing-voice profile for this run. When it does not diff --git a/han-communication/skills/explanation-guidance/SKILL.md b/han-communication/skills/explanation-guidance/SKILL.md index cc55b31a..52cd47d7 100644 --- a/han-communication/skills/explanation-guidance/SKILL.md +++ b/han-communication/skills/explanation-guidance/SKILL.md @@ -8,19 +8,9 @@ description: > in a turn, where readability-guidance governs the shape of a written deliverable. Runs in the caller's context and hands control straight back; it does not produce a deliverable of its own, rewrite anything, or judge the caller's work. Carries guidance only and adds no self-check step. -allowed-tools: Read, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Read --- -## Project Context - -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. - # Explanation Guidance You have invoked `explanation-guidance` to source the shared explanation standard before you talk to a person. This skill diff --git a/han-communication/skills/readability-guidance/SKILL.md b/han-communication/skills/readability-guidance/SKILL.md index 0cd7ff21..9075f14e 100644 --- a/han-communication/skills/readability-guidance/SKILL.md +++ b/han-communication/skills/readability-guidance/SKILL.md @@ -9,18 +9,12 @@ description: > deliverable of its own, rewrite anything, or judge the caller's work. Does not run the adversarial rewrite pass — dispatch the readability-editor agent for that, or use edit-for-readability to rewrite an existing target. Does not cover explaining technical work to a reader who will not implement it — use explanation-guidance for that. -allowed-tools: Read, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Readability Guidance @@ -43,15 +37,15 @@ human reads your deliverable end to end, apply the standard to it. First resolve which writing-voice profile this run uses: -- When either `.han/config.md` probe supplied a `writing-voice` value, resolve it and check that the file exists. A +- When the run's `project .han/config.md` value or its personal `.han/config.md` supplied a `writing-voice` value, resolve it and check that the file exists. A relative value resolves against the folder holding the file that declared it: the working directory for the project - file, and the `personal config directory` the probe reported for the personal file. A full path is used as it stands, + file, and the run's `personal config directory` value for the personal file. A full path is used as it stands, and a leading `~` expands to the home directory. When both files supply a value, the project file's wins. - When the file exists, it is the writing-voice profile for this run, used in place of the built-in profile. - When the file does not exist, warn the user that the configured writing-voice file was not found, naming which of the two configuration files declared it, and ask whether to use the built-in Han voice or skip the writing voice entirely for this run. Honor the answer: fall back to the built-in profile, or proceed with no voice profile at all. -- When neither probe supplied a `writing-voice` value, the built-in profile at +- When neither file supplied a `writing-voice` value, the built-in profile at `${CLAUDE_PLUGIN_ROOT}/references/writing-voice.md` applies. Then read the reference files, in this order, so their full content enters your context: diff --git a/han-core/.claude-plugin/plugin.json b/han-core/.claude-plugin/plugin.json index bb4cadb6..88e8f8f3 100644 --- a/han-core/.claude-plugin/plugin.json +++ b/han-core/.claude-plugin/plugin.json @@ -1,5 +1,5 @@ { "name": "han-core", - "description": "The shared foundation of the Han suite: the specialist agent roster the other plugins dispatch (adversarial reviewers, analysts, architects, investigators, and the plan synthesizer), the project-discovery skill with its project-scanner agent, and the canonical evidence and YAGNI rule files. The documentation skills live in han-documentation, the pre-planning research skills in han-research, the planning skills in han-planning, and the coding skills in han-coding; each depends on han-core.", + "description": "The shared foundation of the Han suite: the specialist agent roster the other plugins dispatch (adversarial reviewers, analysts, architects, investigators, and the plan synthesizer), the load-han-config skill every other skill invokes to read .han/config.md once per run, the project-discovery skill with its project-scanner agent, and the canonical evidence and YAGNI rule files. The documentation skills live in han-documentation, the pre-planning research skills in han-research, the planning skills in han-planning, and the coding skills in han-coding; each depends on han-core.", "version": "3.2.0" } diff --git a/han-core/README.md b/han-core/README.md index e352981f..5a9d231e 100644 --- a/han-core/README.md +++ b/han-core/README.md @@ -17,10 +17,13 @@ have the specialists, project discovery, and the pairing mode. `/pairing` gains interface, and plan-review paths when the plugins carrying those skills are installed alongside it, and names the missing skill rather than substituting when they are not. -**Bundled.** Installed with the `han` meta-plugin. Depends on no other Han plugin. +**Bundled.** Installed with the `han` meta-plugin. Depends on no other Han plugin; every other Han plugin depends on +it, because its `load-han-config` skill is the one place a run reads `.han/config.md`. ## Skills +- [`/load-han-config`](docs/skills/load-han-config.md) — Bring both `.han/config.md` files into the calling skill's + context once per run, so a chain of skills reads the configuration once instead of once per skill. - [`/pairing`](docs/skills/pairing.md) — Build work collaboratively in reviewable pieces, handing each one back before starting the next, so you steer while the work happens instead of reviewing a finished result. - [`/project-discovery`](docs/skills/project-discovery.md) — Scan the repository for languages, frameworks, tooling, and diff --git a/han-core/docs/skills/load-han-config.md b/han-core/docs/skills/load-han-config.md new file mode 100644 index 00000000..79f602d3 --- /dev/null +++ b/han-core/docs/skills/load-han-config.md @@ -0,0 +1,100 @@ +# /load-han-config + +Operator documentation for the `/load-han-config` skill in the han plugin. This document helps you decide _when_ and +_how_ the skill is used. For what the skill does internally, read the skill definition at +[`han-core/skills/load-han-config/SKILL.md`](../../skills/load-han-config/SKILL.md). + +> See also: [Plugin README](../../README.md) · [Repo root](../../../README.md) · [All skills](../../../docs/skills/README.md) · +> [All agents](../../../docs/agents/README.md) · [Configuration](../../../docs/configuration.md) + +## TL;DR + +- **What it does.** Brings this run's Han configuration, the personal and the project `.han/config.md`, into the + calling skill's own context once per run, so the caller applies it per the shared config rule. +- **When it runs.** Every Han skill's `## Project Context` block carries one line that invokes it. You rarely run it + directly; the skill you asked for calls it for you, and a skill that another skill invokes skips the call when the + configuration is already in context. +- **What you get back.** Nothing of its own. It hands control straight back to the caller, which resumes its own + workflow with both configuration files now in context. + +## Key concepts + +- **One place reads the configuration.** Before this skill existed, all 45 skills carried the same two probe lines and + the same 65-word instruction, and a chain of skills loaded the configuration once per skill. Now one skill carries the + probes and the instruction, and a chain loads once. +- **It surfaces raw content, not resolved settings.** The skill is one load-time probe that runs a script. The script + prints both files as they are, where each was found, and the config rule that says how to apply them. The calling + skill still applies the precedence chain, the path resolution, and the degradation rules in + [`config-rule.md`](../../references/config-rule.md), because which settings apply and when a note is due depend on + the caller. When neither file exists, the script says so and names the two paths it tried. +- **It is inline, not forked.** The skill runs in the caller's context so what it surfaces stays available to the + caller. It never sets `context: fork`. +- **Latest copy wins.** When a run ends up loading twice, the newer copy governs. Nothing breaks, and a stale copy is + never preferred. + +## When it is used + +**Invoked when:** + +- A Han skill starts and its `## Project Context` block says to resolve configuration with + `han-core:load-han-config`. The skill checks its own context first: when the loader's `# Load Han Configuration` + heading and the two configuration values are already there, because an earlier skill in the same run loaded them, + it does not invoke the loader again. +- You run it yourself to see which of the two configuration files this run would apply. With no caller it reports + which files were found and stops. + +**Not used for:** + +- **Writing or editing `.han/config.md`.** You author both files by hand; the annotated example in + [Configuration](../../../docs/configuration.md) is the source to copy from. +- **Discovering the project's languages and tooling.** Use [`/project-discovery`](./project-discovery.md), which writes + a reference section into AGENTS.md or CLAUDE.md. + +## How it works + +The skill has no steps. Its one load-time probe runs `scripts/load-han-config.sh`, which resolves the personal +configuration directory (`CLAUDE_CONFIG_DIR`, or `~/.claude`), looks for `.han/config.md` there and in the working +directory, and prints whichever exist, the project file first, each under its own heading and between `BEGIN` and `END` marker +lines, followed by the config rule under a heading of its own, so a heading inside a configuration file is never read +as part of the skill. When the run is inside the +personal configuration directory the two lookups name one file, and it is printed once as the project file. The output +states that these files replace any copy loaded earlier, and that the caller should apply them per the rule and +continue. The probe is guarded, so a script that cannot run degrades to a one-line message rather than aborting the +caller. + +A run begins when you invoke a skill and ends when that skill finishes; every skill it invokes is part of the same +run. A skill you invoke later in the same session is a new run and should load again, so an edit you make to a +configuration file between two commands should reach the second one. The trial ran every skill in a fresh context, so +this in-session case is the one path it did not measure; if a later command keeps old values, run it again in a new +session and report it. + +## Cost and latency + +The skill surfaces the two configuration files and its own short body into context, once per run. A chain of skills +pays that cost once instead of once per skill; a skill invoked on its own pays the same as it did before. + +## Troubleshooting + +- **A skill ran with no configuration although the file exists.** Check that `han-core` is installed: every Han + plugin depends on it, so a normal install carries it, but a plugin installed through Codex, which resolves no + dependencies, needs `han-core` installed beside it. +- **A chained skill reloaded the configuration.** This is harmless, because the latest copy governs. It happens when + the earlier copy fell out of context, for example after a compaction. +- **A consumer skill stops right after the loader call.** The trial behind this skill ran the values case through + same-context skill composition, including a worst-case loader that ends on a final-sounding line, with no early + exits, first through a copy and then through the shipped skill; the records are under + `docs/plans/gh-203-consolidate-config-loading/artifacts/trial/` and `artifacts/trial2/` in that folder. The one + trigger they could not induce is a real `api_retry`, a transient infrastructure fault. If you observe a skill ending right after sourcing + the configuration, re-run it; if it recurs, report it. + +## Related documentation + +- [Plugin README](../../README.md). The plugin's front door: its skills, agents, and how they fit together. +- [Repo root README](../../../README.md). The Han suite landing page. Start here if you arrived from outside the docs tree. +- [Configuration](../../../docs/configuration.md). The operator guide to both `.han/config.md` files and the annotated + example to author from. +- [`config-rule.md`](../../references/config-rule.md). The interpretation contract every calling skill applies to what + this skill surfaces. +- [`/project-discovery`](./project-discovery.md). The sibling skill that writes machine-discovered project context for + other skills to consume. +- [`SKILL.md` for /load-han-config](../../skills/load-han-config/SKILL.md). The internal process definition. diff --git a/han-core/docs/skills/project-discovery.md b/han-core/docs/skills/project-discovery.md index a5ed2681..ccecda9d 100644 --- a/han-core/docs/skills/project-discovery.md +++ b/han-core/docs/skills/project-discovery.md @@ -57,6 +57,8 @@ _how_ to use the skill. For what the skill does internally, read the skill defin specific feature works. - **Architectural assessment.** Use [`/architectural-analysis`](../../../han-coding/docs/skills/architectural-analysis.md) for coupling, data flow, and SOLID. +- **Bringing the `.han/config.md` files into a run.** Use [`/load-han-config`](./load-han-config.md), which every + skill invokes for that; this skill only keeps the project file's pointer in AGENTS.md or CLAUDE.md honest. - **Investigating why a skill found or did not find a config value.** That is a discovery bug. Re-run this skill. ## How to invoke it @@ -156,6 +158,7 @@ URL: https://research.google/pubs/why-google-stores-billions-of-lines-of-code-in discovery section to find the ADR directory. - [`/code-review`](../../../han-coding/docs/skills/code-review.md). Reads the discovery section for lint/build/test commands and for standards and ADR compliance checks. +- [`/load-han-config`](./load-han-config.md). The sibling skill that brings both `.han/config.md` files into a run. - [`project-scanner`](../agents/project-scanner.md). The agent this skill dispatches. - [`SKILL.md` for /project-discovery](../../skills/project-discovery/SKILL.md). The internal process definition. diff --git a/han-core/references/config-rule.md b/han-core/references/config-rule.md index 5c16a2a5..3eaf6bb0 100644 --- a/han-core/references/config-rule.md +++ b/han-core/references/config-rule.md @@ -1,50 +1,4 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema +### Schema Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the @@ -75,13 +29,13 @@ file it sits in. - `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review skill, which defines their line format and how it uses them. Every other skill ignores both silently. -## How a configured path resolves +### How a configured path resolves `output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - **A relative path resolves against the folder holding the file that declared it.** A relative path in the project file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept + personal config directory the loader names. This is what lets one personal writing-voice profile, kept beside the personal config, apply in every project. - **A full path is used as it stands**, including one that points outside the project. - **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving @@ -92,7 +46,7 @@ file it sits in. No path is refused for pointing outside the project. A skill that writes deliverables to a configured `output-directory` outside the working directory does so without comment; the person who configured it chose that. -## Precedence +### Precedence Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: @@ -116,7 +70,7 @@ same key, the project file's line is used; when that line is unusable, the perso used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as `## Extra Agents` entries do. -## Extra agents joining the pool +### Extra agents joining the pool A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would @@ -125,7 +79,7 @@ pool has no effect, whether the duplicate comes from the same file or the other counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. -## Degradation and the one-line note +### Degradation and the one-line note A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose @@ -139,20 +93,17 @@ name, so a message that omits which one leaves the reader opening both. - Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. +- The loader reporting that it did not run: its probe falls back to a one-line message when the script is missing or + fails, and the run then behaves as if no configuration exists, with no note. - A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. - A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. - A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore it silently. - A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. +- A file the loader reports as not found, at either path: no configuration from that file, with no note. The loader + cannot tell a missing file from a directory it could not reach, and neither is distinguishable from a person who + never wrote the file, which is by far the commonest case. A file that loaded but cannot be used is a different case + and keeps the note its own bullet above describes. One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where diff --git a/han-core/scripts/han-config-dir.sh b/han-core/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-core/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-core/scripts/load-han-config.bats b/han-core/scripts/load-han-config.bats new file mode 100755 index 00000000..738d2a19 --- /dev/null +++ b/han-core/scripts/load-han-config.bats @@ -0,0 +1,213 @@ +#!/usr/bin/env bats +# +# Guards the config-loading contract. One skill, han-core:load-han-config, +# is a single load-time probe that runs the load-han-config.sh beside this file. The +# script resolves both .han/config.md files and prints them with the config +# rule, or says that neither was found. Every other shipped skill carries one +# line that invokes the loader and pre-approves the Skill tool, except +# explanation-guidance, which uses no setting and carries nothing. +# +# Keep to bash 3.2 (no mapfile, no declare -A): this runs on macOS locally. +# +# SC2016 is disabled file-wide: every single-quoted string here is literal +# SKILL.md text matched byte for byte, so nothing inside it may expand. +# shellcheck disable=SC2016 + +REPO_ROOT="${BATS_TEST_DIRNAME}/../.." +SCRIPT="${BATS_TEST_DIRNAME}/load-han-config.sh" +LOADER='han-core/skills/load-han-config/SKILL.md' +NO_CONFIG='han-communication/skills/explanation-guidance/SKILL.md' +LINE='Resolve configuration with `han-core:load-han-config` if you have not already this run.' +GRANT='Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh")' +PROBE='!`bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh" 2>/dev/null || echo' +READ_SENTENCE='As your first action, use the Read tool on `.han/config.md`' + +setup() { + TMP="$(mktemp -d)" + mkdir -p "$TMP/project" "$TMP/personal/.han" +} + +teardown() { + rm -rf "$TMP" +} + +shipped_skills() { + cd "$REPO_ROOT" || return 1 + for f in han-*/skills/*/SKILL.md; do printf '%s\n' "$f"; done +} + +line_carriers() { + shipped_skills | grep -v -x -e "$LOADER" -e "$NO_CONFIG" +} + +# --- the script --- + +@test "the loader script is a regular executable file in han-core" { + [ -x "$SCRIPT" ] + [ ! -L "$SCRIPT" ] +} + +@test "with neither file it says so and names both paths it tried" { + cd "$TMP/project" + run env CLAUDE_CONFIG_DIR="$TMP/personal" bash "$SCRIPT" + [ "$status" -eq 0 ] + [[ "$output" == *"no Han configuration was found"* ]] + [[ "$output" == *"$TMP/project/.han/config.md"* ]] + [[ "$output" == *"$TMP/personal/.han/config.md"* ]] + [[ "$output" != *"### Schema"* ]] +} + +@test "with a project file it prints the file and the config rule" { + cd "$TMP/project" + mkdir -p .han && printf -- '---\noutput-directory: docs/out\n---\n' > .han/config.md + run env CLAUDE_CONFIG_DIR="$TMP/personal" bash "$SCRIPT" + [ "$status" -eq 0 ] + [[ "$output" == *"# Load Han Configuration"* ]] + [[ "$output" == *"output-directory: docs/out"* ]] + [[ "$output" == *"## How to apply them: the config rule"* ]] + [[ "$output" == *"### Schema"* ]] + [[ "$output" == *"Personal \`.han/config.md\`: not found at $TMP/personal/.han/config.md"* ]] + [[ "$output" == *"## Project config"* ]] + [[ "$output" == *"===== BEGIN project config ====="* ]] + [[ "$output" == *"===== END project config ====="* ]] + [[ "$output" != *"## Personal config"* ]] + [[ "$output" != *$'\n\n\n'* ]] + [[ "$output" == *$'\n\n## Project config\n\n===== BEGIN project config =====\n---'* ]] + [[ "$output" == *$'---\n\n===== END project config =====\n\n## How to apply them: the config rule\n\n### Schema'* ]] +} + +@test "with a personal file it honors CLAUDE_CONFIG_DIR and prints the file" { + cd "$TMP/project" + printf -- '---\ndefault-swarm-size: large\n---\n' > "$TMP/personal/.han/config.md" + run env CLAUDE_CONFIG_DIR="$TMP/personal" bash "$SCRIPT" + [ "$status" -eq 0 ] + [[ "$output" == *"default-swarm-size: large"* ]] + [[ "$output" == *"Project \`.han/config.md\`: not found at $TMP/project/.han/config.md"* ]] + [[ "$output" == *"### Schema"* ]] + [[ "$output" == *"## Personal config"* ]] + [[ "$output" == *"===== BEGIN personal config ====="* ]] + [[ "$output" == *"===== END personal config ====="* ]] + [[ "$output" != *"## Project config"* ]] +} + +@test "with the variable unset it falls back to the home directory" { + cd "$TMP/project" + mkdir -p "$TMP/home/.claude/.han" && printf -- '---\nwriting-voice: voice.md\n---\n' > "$TMP/home/.claude/.han/config.md" + run env -u CLAUDE_CONFIG_DIR HOME="$TMP/home" bash "$SCRIPT" + [ "$status" -eq 0 ] + [[ "$output" == *"writing-voice: voice.md"* ]] + [[ "$output" == *"$TMP/home/.claude/.han/config.md"* ]] +} + +@test "with both files it prints the project file before the personal file" { + cd "$TMP/project" + mkdir -p .han && printf -- '---\noutput-directory: docs/out\n---\n' > .han/config.md + printf -- '---\ndefault-swarm-size: large\n---\n' > "$TMP/personal/.han/config.md" + run env CLAUDE_CONFIG_DIR="$TMP/personal" bash "$SCRIPT" + [ "$status" -eq 0 ] + project_at="${output%%default-swarm-size: large*}" + [[ "$project_at" == *"output-directory: docs/out"* ]] + [[ "$output" != *$'\n\n\n'* ]] + [[ "$output" == *$'===== END project config =====\n\n## Personal config\n\n===== BEGIN personal config =====\n'* ]] +} + +@test "when both lookups name the same file it prints it once, as the project file" { + mkdir -p "$TMP/personal/.han" && printf -- '---\noutput-directory: docs/out\n---\n' > "$TMP/personal/.han/config.md" + cd "$TMP/personal" + run env CLAUDE_CONFIG_DIR="$TMP/personal" bash "$SCRIPT" + [ "$status" -eq 0 ] + count="$(printf '%s\n' "$output" | grep -c 'output-directory: docs/out')" + [ "$count" -eq 1 ] + [[ "$output" == *"same file"* ]] +} + +@test "the config rule starts at its Schema section and nests under the loader's heading" { + cd "$REPO_ROOT" || return 1 + first="$(grep -m1 -E '^#' han-core/references/config-rule.md)" + [ "$first" = "### Schema" ] + if grep -qE '^## ' han-core/references/config-rule.md; then + echo "config-rule.md must use ### headings so they sit under the loader's ## heading" + return 1 + fi +} + +# --- the skills --- + +@test "the loader is one probe that runs the script, with the matching grant, and never forks" { + cd "$REPO_ROOT" || return 1 + grep -qF -- "$PROBE" "$LOADER" + grep -qF -- "$GRANT" "$LOADER" + if grep -qE '^context:' "$LOADER"; then + echo "the loader must never set context: fork" + return 1 + fi + if grep -qF -- "$READ_SENTENCE" "$LOADER"; then + echo "the loader no longer carries a Read step" + return 1 + fi +} + +@test "every other shipped skill carries the loader line exactly once" { + cd "$REPO_ROOT" || return 1 + for skill in $(line_carriers); do + count="$(grep -cF -- "$LINE" "$skill")" + [ "$count" -eq 1 ] || { + echo "expected the loader line once, found $count in: $skill" + return 1 + } + done +} + +@test "every shipped skill that carries the loader line pre-approves the Skill tool" { + cd "$REPO_ROOT" || return 1 + for skill in $(line_carriers); do + awk '/^---$/ { c++; next } c == 1' "$skill" | grep -qE '(^|[[:space:],])Skill([[:space:],]|$)' || { + echo "allowed-tools does not list Skill, so the loader call may prompt in: $skill" + return 1 + } + done +} + +@test "no shipped skill but the loader carries a config probe, a resolver grant, or the old Read instruction" { + cd "$REPO_ROOT" || return 1 + for skill in $(shipped_skills | grep -v -x "$LOADER"); do + for piece in "load-han-config.sh" "han-config-dir.sh" '- project .han/config.md: !`' "$READ_SENTENCE"; do + if grep -qF -- "$piece" "$skill"; then + echo "old config piece still present in: $skill" + return 1 + fi + done + done +} + +@test "explanation-guidance carries neither the loader line nor a config piece" { + cd "$REPO_ROOT" || return 1 + if grep -qF -- "$LINE" "$NO_CONFIG"; then + echo "explanation-guidance uses no setting and must carry no config piece" + return 1 + fi +} + +@test "no other plugin carries a copy of the loader script" { + cd "$REPO_ROOT" || return 1 + for dir in han-*/; do + pkg="${dir%/}" + [ "$pkg" = "han-core" ] && continue + [ ! -e "${pkg}/scripts/load-han-config.sh" ] || { + echo "stray loader script: ${pkg}/scripts/load-han-config.sh" + return 1 + } + done +} + +@test "every plugin whose skills carry the loader line depends on han-core" { + cd "$REPO_ROOT" || return 1 + for skill in $(line_carriers); do + pkg="${skill%%/*}" + [ "$pkg" = "han-core" ] && continue + grep -qF -- '"han-core"' "${pkg}/.claude-plugin/plugin.json" || { + echo "${pkg}/.claude-plugin/plugin.json does not declare han-core, but $skill invokes the loader" + return 1 + } + done +} diff --git a/han-core/scripts/load-han-config.sh b/han-core/scripts/load-han-config.sh new file mode 100755 index 00000000..a7016544 --- /dev/null +++ b/han-core/scripts/load-han-config.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# Loads this run's Han configuration for han-core:load-han-config, whose one +# probe runs this script when the skill loads. Resolves the project and the +# personal .han/config.md, prints whichever exist together with the config rule +# that says how to apply them, or says that neither was found and names the +# paths it tried. Never exits non-zero: a missing file is a normal state. +# +# SC2016 is disabled file-wide: the backticks in the printf formats are Markdown +# code spans in the printed text, not expansions. +# shellcheck disable=SC2016 +set -u + +personal_dir="${CLAUDE_CONFIG_DIR:-$HOME/.claude}" +personal="$personal_dir/.han/config.md" +project="$PWD/.han/config.md" + +script_dir="$(dirname "$0")" +rule="$script_dir/../references/config-rule.md" + +same_file="" +if [ -f "$project" ] && [ -f "$personal" ] && [ "$project" -ef "$personal" ]; then + same_file="yes" +fi + +printf '# Load Han Configuration\n\n' + +if [ ! -f "$project" ] && [ ! -f "$personal" ]; then + printf 'When this skill loaded, no Han configuration was found:\n\n' + printf -- '- Project `.han/config.md`: not found at %s\n' "$project" + printf -- '- Personal `.han/config.md`: not found at %s\n\n' "$personal" + printf 'Behave as if no configuration exists, with no note about it, and continue with the skill that invoked this one.\n' + exit 0 +fi + +printf 'Loaded when this skill started. These files replace any copy loaded earlier in this context.\n\n' +if [ -f "$project" ]; then + printf -- '- Project `.han/config.md`: found at %s\n' "$project" +else + printf -- '- Project `.han/config.md`: not found at %s\n' "$project" +fi +if [ -n "$same_file" ]; then + printf -- '- Personal `.han/config.md`: the same file (the run is inside the personal config directory %s), read once as the project file\n' "$personal_dir" +elif [ -f "$personal" ]; then + printf -- '- Personal `.han/config.md`: found at %s (personal config directory %s)\n' "$personal" "$personal_dir" +else + printf -- '- Personal `.han/config.md`: not found at %s\n' "$personal" +fi + +# Each injected file sits between BEGIN and END markers that name it, so its +# own headings are never mistaken for part of this skill. +# One blank line sits before every heading and marker. Command substitution +# drops a file's trailing newlines, so the spacing does not depend on them. +if [ -f "$project" ]; then + printf '\n## Project config\n\n===== BEGIN project config =====\n%s\n\n===== END project config =====\n' "$(cat "$project")" +fi +if [ -f "$personal" ] && [ -z "$same_file" ]; then + printf '\n## Personal config\n\n===== BEGIN personal config =====\n%s\n\n===== END personal config =====\n' "$(cat "$personal")" +fi + +printf '\n## How to apply them: the config rule\n\n' +if [ -f "$rule" ]; then + printf '%s\n' "$(cat "$rule")" +else + printf 'The config rule (references/config-rule.md) could not be read beside this script; apply the project file over the personal file setting by setting, resolve a relative path against the folder holding the file that declared it, and ignore anything unusable with a one-line note.\n' +fi +printf '\nApply the files above per the rule at the point your workflow uses a setting, say nothing about the configuration itself, and continue with the skill that invoked this one.\n' diff --git a/han-core/skills/load-han-config/SKILL.md b/han-core/skills/load-han-config/SKILL.md new file mode 100644 index 00000000..ae51a07c --- /dev/null +++ b/han-core/skills/load-han-config/SKILL.md @@ -0,0 +1,13 @@ +--- +name: load-han-config +description: > + Brings this run's Han configuration, the personal and the project .han/config.md, into the calling skill's own + context once per run, together with the config rule that says how to apply it. Use when a Han skill's Project + Context says to resolve configuration with han-core:load-han-config, or when you want to see which configuration + files this run would apply. Runs in the caller's context and hands control straight back; it resolves no setting, + shows no note, and produces no deliverable. Does not write or edit .han/config.md, and does not scan the repository + for its languages and tooling — use project-discovery for that. +allowed-tools: Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh") +--- + +!`bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh" 2>/dev/null || echo "The Han configuration loader did not run, so no configuration applies to this run; continue with the skill that invoked this one."` diff --git a/han-core/skills/pairing/SKILL.md b/han-core/skills/pairing/SKILL.md index fa14fa4d..d751f5f4 100644 --- a/han-core/skills/pairing/SKILL.md +++ b/han-core/skills/pairing/SKILL.md @@ -11,21 +11,15 @@ description: > code-walkthrough. Does not explain, summarize, or research something instead of producing it — use code-overview or research. allowed-tools: - Read, Write, Edit, Glob, Grep, Skill, Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Read, Write, Edit, Glob, Grep, Skill, Bash(find *) argument-hint: "[what to pair on]" --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## The contract this skill runs on @@ -46,7 +40,7 @@ Two constraints from that file govern every step below and are repeated here bec ## Step 1: Resolve the Record Location Resolve where the running feedback record will be written, using the output base directory from the configuration -probed above. Absent any configuration, write it beside the work under `.han/pairing/`. +`han-core:load-han-config` surfaced. Absent any configuration, write it beside the work under `.han/pairing/`. Name the file for this run so a second run in the same repository does not overwrite the first. State the path to the person in Step 4's plan, in one clause, BECAUSE a record they cannot find is not a record. diff --git a/han-core/skills/project-discovery/SKILL.md b/han-core/skills/project-discovery/SKILL.md index d08c07f2..21ae4439 100644 --- a/han-core/skills/project-discovery/SKILL.md +++ b/han-core/skills/project-discovery/SKILL.md @@ -5,10 +5,9 @@ description: > where things live — and writes a concise reference section directly into the project's AGENTS.md or CLAUDE.md for other skills, agents, and hooks to consume. Use when scanning, analyzing, or detecting the project's technology stack, build tools, or repository structure. Does not create or update project documentation — use project-documentation for - writing feature or system docs. + writing feature or system docs. Does not bring the `.han/config.md` files into a run — use load-han-config for that. allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(git symbolic-ref *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(git symbolic-ref *), Bash(find *) --- ## Project Context @@ -17,13 +16,8 @@ allowed-tools: - AGENTS.md: !`find . -maxdepth 1 -name "AGENTS.md" -type f` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - README: !`find . -maxdepth 1 -name "README*" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Project Discovery @@ -109,8 +103,8 @@ file already covers the project's core attributes, and stop. Han skills read project-local overrides from the project's `.han/config.md` when a project carries one (see [../../references/config-rule.md](../../references/config-rule.md)). This step keeps the target file's pointer to that -config accurate, using the same consent gate and deduplication discipline as Step 4. The Project Context probe above -shows whether the file exists. +config accurate, using the same consent gate and deduplication discipline as Step 4. The `project .han/config.md` value +`han-core:load-han-config` surfaced shows whether the file exists. - **`.han/config.md` exists and the target file contains no reference to it:** use `AskUserQuestion` to offer adding a one-line pointer beside the `## Project Discovery` section, for example: diff --git a/han-ddd/references/config-rule.md b/han-ddd/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-ddd/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-ddd/scripts/han-config-dir.sh b/han-ddd/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-ddd/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-ddd/skills/ddd-analysis/SKILL.md b/han-ddd/skills/ddd-analysis/SKILL.md index ef4f8ee0..327f046b 100644 --- a/han-ddd/skills/ddd-analysis/SKILL.md +++ b/han-ddd/skills/ddd-analysis/SKILL.md @@ -12,7 +12,7 @@ description: or code-review." arguments: size argument-hint: "[size: small | medium | large] [focus area: module or directory to restrict analysis to]" -allowed-tools: Read, Glob, Grep, Agent, Write, Bash(find *), Bash(date *), Bash(mkdir *), Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read, Glob, Grep, Agent, Write, Bash(find *), Bash(date *), Bash(mkdir *) --- ## Project Context @@ -20,14 +20,8 @@ allowed-tools: Read, Glob, Grep, Agent, Write, Bash(find *), Bash(date *), Bash( - git installed: !`which git 2>/dev/null || echo "not installed"` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A -read that returns no file is no personal configuration: continue silently. When that file or the -`project .han/config.md` probe supplies content, apply it per -[config-rule.md](../../references/config-rule.md), which governs precedence between the two files, relative-path -resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -66,7 +60,7 @@ Read these before dispatching anything. They constrain every step below. **Bind `$size`.** If the user passed `small`, `medium`, or `large` as the first positional argument, bind `$size` to it. If `$size` is `none provided` and the project config supplies a `default-swarm-size` value via -`config-rule.md`, adopt that value as `$size` and note the config as the source. If no value is available from +the config rule the loader surfaced, adopt that value as `$size` and note the config as the source. If no value is available from either source, set `$size` to `medium`. **Resolve the focus area.** Take the remaining argument and conversation context as the focus area. If a focus area @@ -88,7 +82,7 @@ directing note — it biases attention without narrowing scope. **Resolve the run folder.** Determine where this run's artifacts will land before dispatching any agent: 1. **Configured `output-directory`**: When the config read above supplied an `output-directory`, resolve it per - [config-rule.md](../../references/config-rule.md) (relative path resolves against the file that declared it; + the config rule `han-core:load-han-config` surfaced (relative path resolves against the file that declared it; `~/` expands to home; full path is used as-is). Write the run folder beneath that resolved base. 2. **No configured value**: Write outside the repository — use `${TMPDIR:-/tmp}` as the base. This keeps an unconfigured analysis out of version control, matching the same principle that governs `code-overview`. diff --git a/han-documentation/references/config-rule.md b/han-documentation/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-documentation/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-documentation/scripts/han-config-dir.sh b/han-documentation/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-documentation/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-documentation/skills/architectural-decision-record/SKILL.md b/han-documentation/skills/architectural-decision-record/SKILL.md index 42951553..c5bc7933 100644 --- a/han-documentation/skills/architectural-decision-record/SKILL.md +++ b/han-documentation/skills/architectural-decision-record/SKILL.md @@ -8,8 +8,7 @@ description: > instead. argument-hint: "[topic-or-title or document-path]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(mkdir *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(mkdir *), Bash(find *) --- # Create ADR @@ -40,13 +39,8 @@ allowed-tools: - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Step 1: Determine Mode diff --git a/han-documentation/skills/project-documentation/SKILL.md b/han-documentation/skills/project-documentation/SKILL.md index 8b9f05da..4f93ba4f 100644 --- a/han-documentation/skills/project-documentation/SKILL.md +++ b/han-documentation/skills/project-documentation/SKILL.md @@ -11,21 +11,15 @@ description: > code-overview for that. argument-hint: "[feature-name or document-path]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(date *), Bash(mkdir *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(date *), Bash(mkdir *), Bash(find *) --- ## Project Context - CLAUDE.md exists: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Project Documentation diff --git a/han-documentation/skills/runbook/SKILL.md b/han-documentation/skills/runbook/SKILL.md index 16af3432..3999a454 100644 --- a/han-documentation/skills/runbook/SKILL.md +++ b/han-documentation/skills/runbook/SKILL.md @@ -9,8 +9,7 @@ description: > architectural-decision-record. Does not create coding standards — use coding-standard. argument-hint: "[topic or scenario, or path to existing runbook to update]" allowed-tools: - Read, Write, Edit, Glob, Bash(git config *), Bash(whoami), Bash(date *), Bash(mkdir *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Bash(git config *), Bash(whoami), Bash(date *), Bash(mkdir *), Bash(find *) --- # Create or Update Runbook @@ -48,13 +47,8 @@ allowed-tools: - Today's date: !`date +%Y-%m-%d` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Step 1: Determine Mode diff --git a/han-feedback/.claude-plugin/plugin.json b/han-feedback/.claude-plugin/plugin.json index c8baec59..9aaf23ba 100644 --- a/han-feedback/.claude-plugin/plugin.json +++ b/han-feedback/.claude-plugin/plugin.json @@ -1,5 +1,6 @@ { "name": "han-feedback", - "description": "Post-session feedback skill for the Han suite. Captures structured observations, ratings, and improvement ideas on the Han skills you ran in a session and optionally posts them as a GitHub issue to testdouble/han. Opt-in: installed on its own, not pulled in by the han meta-plugin.", - "version": "2.0.2" + "description": "Post-session feedback skill for the Han suite. Captures structured observations, ratings, and improvement ideas on the Han skills you ran in a session and optionally posts them as a GitHub issue to testdouble/han. Depends on han-core for the shared configuration loader. Opt-in: installed on its own, not pulled in by the han meta-plugin.", + "version": "2.0.2", + "dependencies": ["han-core"] } diff --git a/han-feedback/README.md b/han-feedback/README.md index e2c735af..d17c0d8e 100644 --- a/han-feedback/README.md +++ b/han-feedback/README.md @@ -5,7 +5,7 @@ just used, so the maintainers hear what worked and what did not. Reach for it at report back on how the suite is working for you. **Opt-in.** Installed on its own, not bundled by the `han` meta-plugin. Install it with -`/plugin install han-feedback@han`. Depends on no other Han plugin. +`/plugin install han-feedback@han`. Depends on `han-core` for the shared configuration loader. ## Skills diff --git a/han-feedback/references/config-rule.md b/han-feedback/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-feedback/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-feedback/scripts/han-config-dir.sh b/han-feedback/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-feedback/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-feedback/skills/han-feedback/SKILL.md b/han-feedback/skills/han-feedback/SKILL.md index f9f07efc..0c905c07 100644 --- a/han-feedback/skills/han-feedback/SKILL.md +++ b/han-feedback/skills/han-feedback/SKILL.md @@ -7,20 +7,14 @@ description: > or research options; use code-review, investigate, or research for those. Does not provide feedback on skills or agents from non-Han plugins. allowed-tools: - Read, Write, Bash(ls *), Bash(mkdir *), Bash(gh *), Bash(date *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Bash(ls *), Bash(mkdir *), Bash(gh *), Bash(date *) --- ## Project Context - Today's date: !`date +%Y-%m-%d` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Capture Feedback diff --git a/han-github/references/config-rule.md b/han-github/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-github/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-github/scripts/han-config-dir.sh b/han-github/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-github/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-github/skills/post-code-review-to-pr/SKILL.md b/han-github/skills/post-code-review-to-pr/SKILL.md index 5ce584b7..d6b983ad 100644 --- a/han-github/skills/post-code-review-to-pr/SKILL.md +++ b/han-github/skills/post-code-review-to-pr/SKILL.md @@ -9,8 +9,7 @@ argument-hint: "[type: security | testing | architecture | data | observability | resilience | release | maintainability | docs | ux | work-ticket | a type from .han/config.md] [focus]" allowed-tools: - Bash(jq *), Bash(gh *), Bash(git *), Bash(make *), Bash(npm *), Read, Write, Grep, Glob, Skill, Agent, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Bash(jq *), Bash(gh *), Bash(git *), Bash(make *), Bash(npm *), Read, Write, Grep, Glob, Skill, Agent --- When running a PR code review, follow the process outlined here. @@ -28,13 +27,8 @@ be installed. In either case, immediately stop. - current branch: !`git branch --show-current 2>/dev/null || echo unknown` - default branch: !`git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || echo unknown` - changed files: !`gh pr diff --name-only 2>/dev/null || echo "no pr"` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Step 1: Validate PR State diff --git a/han-github/skills/update-pr-description/SKILL.md b/han-github/skills/update-pr-description/SKILL.md index a2179a22..2138eabc 100644 --- a/han-github/skills/update-pr-description/SKILL.md +++ b/han-github/skills/update-pr-description/SKILL.md @@ -6,8 +6,7 @@ description: > comments — use code-review for local review or post-code-review-to-pr for posting a review to GitHub. argument-hint: "[optional context about the PR]" allowed-tools: - Read, Glob, Grep, Agent, Bash(git *), Bash(gh *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Glob, Grep, Agent, Bash(git *), Bash(gh *) --- ## Pre-requisites @@ -26,13 +25,8 @@ allowed-tools: - branch summary: !`git log origin/HEAD..HEAD --oneline 2>/dev/null || echo unknown` - branch stats: !`git diff origin/HEAD...HEAD --stat 2>/dev/null || echo unknown` - branch changes: !`git diff origin/HEAD...HEAD 2>/dev/null || echo unknown` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Step 1: Validate Branch State diff --git a/han-github/skills/work-items-to-issues/SKILL.md b/han-github/skills/work-items-to-issues/SKILL.md index 14bec77f..7ffbf617 100644 --- a/han-github/skills/work-items-to-issues/SKILL.md +++ b/han-github/skills/work-items-to-issues/SKILL.md @@ -9,19 +9,12 @@ description: > argument-hint: "[path to work-items.md] [target repo(s), e.g. org/repo] [--label name (optional)] [--assignee user (optional)]" allowed-tools: - Read, Write, Edit, Glob, Grep, Bash(gh *), Bash(git *), Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Bash(gh *), Bash(git *), Bash(find *) --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Work Items to GitHub Issues diff --git a/han-linear/.claude-plugin/plugin.json b/han-linear/.claude-plugin/plugin.json index a223b3a5..9123ebe9 100644 --- a/han-linear/.claude-plugin/plugin.json +++ b/han-linear/.claude-plugin/plugin.json @@ -1,5 +1,6 @@ { "name": "han-linear", - "description": "Linear-facing extensions to the Han suite. Adds work-items-to-linear, which creates one Linear issue per slice from a work-items file. Works through the Linear MCP server and requires it to be configured. Depends on no other Han plugin. Opt-in: installed on its own, not pulled in by the han meta-plugin.", - "version": "1.1.2" + "description": "Linear-facing extensions to the Han suite. Adds work-items-to-linear, which creates one Linear issue per slice from a work-items file. Works through the Linear MCP server and requires it to be configured. Depends on han-core for the shared configuration loader. Opt-in: installed on its own, not pulled in by the han meta-plugin.", + "version": "1.1.2", + "dependencies": ["han-core"] } diff --git a/han-linear/README.md b/han-linear/README.md index 90aa8001..28a7efcb 100644 --- a/han-linear/README.md +++ b/han-linear/README.md @@ -5,7 +5,7 @@ resolving the team's real states, labels, Projects, and members before it create has been broken into work items and you track that work in Linear. **Opt-in.** Installed on its own, not bundled by the `han` meta-plugin. Install it with -`/plugin install han-linear@han`. Depends on no other Han plugin and requires a configured Linear MCP server. +`/plugin install han-linear@han`. Depends on `han-core` for the shared configuration loader and requires a configured Linear MCP server. ## Skills diff --git a/han-linear/references/config-rule.md b/han-linear/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-linear/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-linear/scripts/han-config-dir.sh b/han-linear/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-linear/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-linear/skills/work-items-to-linear/SKILL.md b/han-linear/skills/work-items-to-linear/SKILL.md index 1d9e9355..6d2bae44 100644 --- a/han-linear/skills/work-items-to-linear/SKILL.md +++ b/han-linear/skills/work-items-to-linear/SKILL.md @@ -13,22 +13,15 @@ argument-hint: "[path to work-items.md] --team team [--project Linear project] [--parent issue id] [--state name] [--label name (repeatable)] [--assignee name, email, or me]" allowed-tools: - Read, Write, Edit, Glob, Grep, Bash(find *), mcp__plugin_linear_linear__save_issue, + Skill, Read, Write, Edit, Glob, Grep, Bash(find *), mcp__plugin_linear_linear__save_issue, mcp__plugin_linear_linear__get_issue, mcp__plugin_linear_linear__list_teams, mcp__plugin_linear_linear__list_issue_statuses, mcp__plugin_linear_linear__list_issue_labels, - mcp__plugin_linear_linear__list_users, mcp__plugin_linear_linear__get_user, mcp__plugin_linear_linear__list_projects, - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + mcp__plugin_linear_linear__list_users, mcp__plugin_linear_linear__get_user, mcp__plugin_linear_linear__list_projects --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Work Items to Linear Issues diff --git a/han-planning/references/config-rule.md b/han-planning/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-planning/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-planning/scripts/han-config-dir.sh b/han-planning/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-planning/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-planning/skills/iterative-plan-review/SKILL.md b/han-planning/skills/iterative-plan-review/SKILL.md index aa3552cb..7204200f 100644 --- a/han-planning/skills/iterative-plan-review/SKILL.md +++ b/han-planning/skills/iterative-plan-review/SKILL.md @@ -11,21 +11,15 @@ description: > arguments: size argument-hint: "[size: small | medium | large | dynamic] [context or path to plan file]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(find *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Review Approach @@ -170,7 +164,7 @@ how much domain coverage a band actually buys. argument), use it: a band value is the size and skips the signal-based classification above, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is empty and the project config supplies a band via `default-swarm-size` (per the config rule in -[../../references/config-rule.md](../../references/config-rule.md)), use that band and skip the signal-based +the config rule `han-core:load-han-config` surfaced), use that band and skip the signal-based classification. State the chosen size and mode to the user in one line with the justification (e.g., "Medium: 4 files, one auth surface", "Medium: passed via `$size`", or "Medium: from the project `.han/config.md` `default-swarm-size`", naming whichever of the two files supplied it). If the user asked for team review on a plan that would otherwise be small, honor the request and treat it as medium-or-larger. If diff --git a/han-planning/skills/iterative-plan-review/references/team-selection.md b/han-planning/skills/iterative-plan-review/references/team-selection.md index 8a15642c..9249bca8 100644 --- a/han-planning/skills/iterative-plan-review/references/team-selection.md +++ b/han-planning/skills/iterative-plan-review/references/team-selection.md @@ -64,7 +64,7 @@ review. Draw from: - Honor any agents the user named explicitly. - Extra agents named in the project config's `## Extra Agents` list join this specialist pool and compete under the same what-the-plan-touches selection and specialist caps, per - [../../../references/config-rule.md](../../../references/config-rule.md): select one only when the plan touches its stated + the config rule `han-core:load-han-config` surfaced: select one only when the plan touches its stated specialty, count it against the specialist cap, and skip an entry that does not resolve to a dispatchable agent with a one-line note. - Justify each additional specialist in one line — what in the plan requires them. diff --git a/han-planning/skills/plan-a-change/SKILL.md b/han-planning/skills/plan-a-change/SKILL.md index 7cf91b74..e73b5375 100644 --- a/han-planning/skills/plan-a-change/SKILL.md +++ b/han-planning/skills/plan-a-change/SKILL.md @@ -12,21 +12,15 @@ description: > arguments: size argument-hint: "[size: small | medium | large | dynamic] [what needs to change, optional: source findings path]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(git *), Bash(mkdir *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(git *), Bash(mkdir *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -98,7 +92,7 @@ place the skill stops before doing any work. ask the user to name one. "Restructure the codebase" is not a valid input. **Resolve the output location** through the precedence chain in -[../../references/config-rule.md](../../references/config-rule.md): +the config rule `han-core:load-han-config` surfaced: - A folder the user named wins. - Otherwise, the `output-directory` setting from the project or personal `.han/config.md`, with the run's own folder diff --git a/han-planning/skills/plan-a-change/references/team-selection.md b/han-planning/skills/plan-a-change/references/team-selection.md index df86ddd7..13f41a18 100644 --- a/han-planning/skills/plan-a-change/references/team-selection.md +++ b/han-planning/skills/plan-a-change/references/team-selection.md @@ -30,7 +30,7 @@ The cap counts **chosen specialists**. One seat is filled on every team before a **Size override.** If `$size` is non-empty (the user passed `small`, `medium`, `large`, or `dynamic` as the first argument), use it: a band value is the size and skips the signal-based classification above, while `dynamic` forces signal-based classification even when a config sets a default band. If `$size` is empty and a `.han/config.md` supplies -a band via `default-swarm-size` (per [../../../references/config-rule.md](../../../references/config-rule.md)), use that +a band via `default-swarm-size` (per the config rule `han-core:load-han-config` surfaced), use that band and skip the classification. Both caps still scale to the chosen size. State the chosen size, the recommended team, and the reason in one short message before launching agents — for example @@ -73,7 +73,7 @@ Select additional specialists up to the cap, based on what the area actually con rendered output a person reads. Extra agents named in a `.han/config.md` `## Extra Agents` list join this pool and compete under the same selection and -caps, per [../../../references/config-rule.md](../../../references/config-rule.md). Count a selected extra agent against +caps, per the config rule `han-core:load-han-config` surfaced. Count a selected extra agent against the cap, and skip an entry that does not resolve to a dispatchable agent with a one-line note. ## Domain-scoped briefs diff --git a/han-planning/skills/plan-a-feature/SKILL.md b/han-planning/skills/plan-a-feature/SKILL.md index 216bf73d..6f50e720 100644 --- a/han-planning/skills/plan-a-feature/SKILL.md +++ b/han-planning/skills/plan-a-feature/SKILL.md @@ -11,21 +11,15 @@ description: > arguments: size argument-hint: "[size: small | medium | large | dynamic] [feature description, optional: output folder path]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -303,7 +297,7 @@ This size drives the team-size cap in Step 6: **Size override.** A non-empty `$size` wins: a band value skips the signal-based classification above, while `dynamic` forces it even when a config sets a default band. When `$size` is empty and a config supplies `default-swarm-size` (per -[config-rule.md](../../references/config-rule.md)), use that band and skip the classification. The team cap scales to +the config rule `han-core:load-han-config` surfaced), use that band and skip the classification. The team cap scales to whichever size wins. State the chosen size, the recommended specialists, and the reason in one short message before launching agents, naming which of the two config files supplied a band. If the user disagrees, accept their override of the size, the specialists, or both. diff --git a/han-planning/skills/plan-a-feature/references/review-team-briefs.md b/han-planning/skills/plan-a-feature/references/review-team-briefs.md index a5d27e60..7a990530 100644 --- a/han-planning/skills/plan-a-feature/references/review-team-briefs.md +++ b/han-planning/skills/plan-a-feature/references/review-team-briefs.md @@ -28,7 +28,7 @@ Select the remaining specialists by matching domain to feature, under the size c | `han-core:risk-analyst` | Significant blast radius, where risks need prioritizing. | Extra agents named in the project config's `## Extra Agents` list join this pool and compete under the same -domain-to-feature matching and size cap, per [`config-rule.md`](../../../references/config-rule.md). Select one only +domain-to-feature matching and size cap, per the config rule `han-core:load-han-config` surfaced. Select one only when the feature touches its stated specialty, count it against the cap, brief it with the spec sections relevant to its domain, and skip an entry that does not resolve to a dispatchable agent with a one-line note. diff --git a/han-planning/skills/plan-a-phased-build/SKILL.md b/han-planning/skills/plan-a-phased-build/SKILL.md index 579d4203..83a54b81 100644 --- a/han-planning/skills/plan-a-phased-build/SKILL.md +++ b/han-planning/skills/plan-a-phased-build/SKILL.md @@ -9,21 +9,15 @@ description: > plan into independently-grabbable work items — use plan-work-items. argument-hint: "[source context path or description, optional: output folder path, optional: shaping context]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles diff --git a/han-planning/skills/plan-implementation/SKILL.md b/han-planning/skills/plan-implementation/SKILL.md index e46110a9..52ab26f2 100644 --- a/han-planning/skills/plan-implementation/SKILL.md +++ b/han-planning/skills/plan-implementation/SKILL.md @@ -11,21 +11,15 @@ description: > arguments: size argument-hint: "[size: small | medium | large | dynamic] [feature specification path, optional: additional context]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(git *), Bash(mkdir *), Bash(cp *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(git *), Bash(mkdir *), Bash(cp *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles diff --git a/han-planning/skills/plan-implementation/references/team-selection.md b/han-planning/skills/plan-implementation/references/team-selection.md index 870998f8..6ceda2b8 100644 --- a/han-planning/skills/plan-implementation/references/team-selection.md +++ b/han-planning/skills/plan-implementation/references/team-selection.md @@ -29,7 +29,7 @@ specialist is chosen, so counting seats would make the medium band identical to argument), use it: a band value is the size and skips the signal-based classification above, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is empty and the project config supplies a band via `default-swarm-size` (per the config rule in -[../../../references/config-rule.md](../../../references/config-rule.md)), use that band and skip the signal-based +the config rule `han-core:load-han-config` surfaced), use that band and skip the signal-based classification. The specialist cap and round cap still scale to the chosen size. State the chosen size, the recommended team, and the reason for the size choice to the user in one short message before launching agents (e.g., "Medium: two subsystems, small auth surface", "Medium: passed via `$size`", or "Medium: from the project `.han/config.md` @@ -77,7 +77,7 @@ specialist rather than discovering a gap late. Unless the user specified a team Extra agents named in the project config's `## Extra Agents` list join this specialist pool and compete under the same what-the-feature-touches selection and specialist caps, per -[../../../references/config-rule.md](../../../references/config-rule.md): select one only when the feature touches its +the config rule `han-core:load-han-config` surfaced: select one only when the feature touches its stated specialty, count it against the specialist cap, and skip an entry that does not resolve to a dispatchable agent with a one-line note. diff --git a/han-planning/skills/plan-work-items/SKILL.md b/han-planning/skills/plan-work-items/SKILL.md index f44f5c8f..6552e89c 100644 --- a/han-planning/skills/plan-work-items/SKILL.md +++ b/han-planning/skills/plan-work-items/SKILL.md @@ -9,8 +9,7 @@ description: > plan-a-phased-build for that. Does not write code — use tdd to implement a work item. argument-hint: "[implementation plan path or feature name, optional; output folder, optional]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), Bash(cp *) --- ## Project Context @@ -18,13 +17,8 @@ allowed-tools: - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` - feature-implementation-plan.md: !`find . -maxdepth 5 -name "feature-implementation-plan.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # Plan Work Items diff --git a/han-planning/skills/reassess-approach/SKILL.md b/han-planning/skills/reassess-approach/SKILL.md index 1dc87452..ce9b0744 100644 --- a/han-planning/skills/reassess-approach/SKILL.md +++ b/han-planning/skills/reassess-approach/SKILL.md @@ -12,21 +12,15 @@ description: > architecture and stop at findings — use architectural-analysis. argument-hint: "[plan file or code path] [optional: findings file path] [optional: why you are asking]" allowed-tools: - Read, Write, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Glob, Grep, Agent, Bash(find *), Bash(mkdir *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -73,7 +67,7 @@ Determine how the skill was reached and what it is looking at. recorded". 5. **Output location.** For a plan subject, the report lands in that plan's `artifacts/` folder as `approach-reassessment-{n}.md`, with `{n}` continuing from any existing reassessment files there. For a code subject, - resolve the folder per [config-rule.md](../../references/config-rule.md): a folder the user named wins; otherwise the + resolve the folder per the config rule `han-core:load-han-config` surfaced: a folder the user named wins; otherwise the `output-directory` setting; otherwise a three-to-five-word kebab-case folder under the documentation root discovered from CLAUDE.md's `## Project Discovery` section, `project-discovery.md`, or a Glob fallback (`docs/plans/`, `docs/`). In hand-invoked mode on a code subject, confirm the folder name before writing. diff --git a/han-plugin-builder/.claude-plugin/plugin.json b/han-plugin-builder/.claude-plugin/plugin.json index 066d477c..27ae2857 100644 --- a/han-plugin-builder/.claude-plugin/plugin.json +++ b/han-plugin-builder/.claude-plugin/plugin.json @@ -1,5 +1,6 @@ { "name": "han-plugin-builder", - "description": "Guidance and tooling for building Claude Code skills and plugins. Carries the full body of skill-authoring, agent-authoring, and plugin-configuration guidance, and an init step that vendors that guidance into any repo as a path-scoped rule index so contributors get the right guidance loaded for the file they are editing. Standalone and opt-in: depends on nothing and is not bundled by the han meta-plugin.", - "version": "2.2.1" + "description": "Guidance and tooling for building Claude Code skills and plugins. Carries the full body of skill-authoring, agent-authoring, and plugin-configuration guidance, and an init step that vendors that guidance into any repo as a path-scoped rule index so contributors get the right guidance loaded for the file they are editing. Opt-in: depends on han-core for the shared configuration loader and is not bundled by the han meta-plugin.", + "version": "2.2.1", + "dependencies": ["han-core"] } diff --git a/han-plugin-builder/README.md b/han-plugin-builder/README.md index 31d96e01..c9958c8e 100644 --- a/han-plugin-builder/README.md +++ b/han-plugin-builder/README.md @@ -6,7 +6,7 @@ against that guidance. Reach for it when you are building your own skills, agent product features. **Opt-in.** Installed on its own, not bundled by the `han` meta-plugin. Install it with -`/plugin install han-plugin-builder@han`. Depends on nothing, so it does not pull `han-core` along. +`/plugin install han-plugin-builder@han`. Depends on `han-core` for the shared configuration loader, so installing it pulls `han-core` along. ## Skills diff --git a/han-plugin-builder/docs/skills/agent-builder.md b/han-plugin-builder/docs/skills/agent-builder.md index 219e221d..8adb0d6a 100644 --- a/han-plugin-builder/docs/skills/agent-builder.md +++ b/han-plugin-builder/docs/skills/agent-builder.md @@ -36,7 +36,7 @@ decide _when_ and _how_ to use the skill. For what the skill does internally, re splitting it. - **Agents are self-contained.** Unlike a skill, an agent is a single flat `.md` file with no `references/` folder, no `scripts/`, and no context injection. Everything the agent needs is inlined. The skill enforces this throughout. -- **Self-contained review.** `han-plugin-builder` depends on nothing and ships no agents, so the review is done inline +- **Self-contained review.** `han-plugin-builder` depends only on `han-core` and ships no agents, so the review is done inline by reading the guidance, not by dispatching a review team. ## When to use it diff --git a/han-plugin-builder/docs/skills/guidance.md b/han-plugin-builder/docs/skills/guidance.md index b741915e..86854b65 100644 --- a/han-plugin-builder/docs/skills/guidance.md +++ b/han-plugin-builder/docs/skills/guidance.md @@ -42,7 +42,9 @@ decide _when_ and _how_ to use the skill. For what the skill does internally, re - **No dependency after vendoring.** Once `init` has run, the three skills and their guidance live in the repo. Anyone using the repo can run them and get the right guidance surfaced even if the `han-plugin-builder` plugin is never installed. -- **Standalone and opt-in.** The plugin depends on nothing and is not bundled by the `han` meta-plugin. Install it on +- **Opt-in, depends on `han-core`.** The plugin is not bundled by the `han` meta-plugin, and it depends on `han-core` + for the shared configuration loader. The vendored copies drop the loader line, so they run with no `.han/config.md` + applied; install `han-core` and run the plugin's own skills when you want the configuration honored. Install it on its own. ## When to use it diff --git a/han-plugin-builder/docs/skills/skill-builder.md b/han-plugin-builder/docs/skills/skill-builder.md index efbf06a8..124b7bdb 100644 --- a/han-plugin-builder/docs/skills/skill-builder.md +++ b/han-plugin-builder/docs/skills/skill-builder.md @@ -32,7 +32,7 @@ decide _when_ and _how_ to use the skill. For what the skill does internally, re - **Apply-as-you-go, verify-at-the-end.** The interview consults the governing guidance document when a decision is on the table; a final review pass re-reads every relevant document and corrects the finished files. The interview gets each decision approximately right; the review pass makes the artifact correct. -- **Self-contained review.** `han-plugin-builder` depends on nothing and ships no agents, so the review is done inline +- **Self-contained review.** `han-plugin-builder` depends only on `han-core` and ships no agents, so the review is done inline by reading the guidance, not by dispatching a review team. ## When to use it diff --git a/han-plugin-builder/references/config-rule.md b/han-plugin-builder/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-plugin-builder/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-plugin-builder/scripts/han-config-dir.sh b/han-plugin-builder/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-plugin-builder/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-plugin-builder/skills/agent-builder/SKILL.md b/han-plugin-builder/skills/agent-builder/SKILL.md index c8858f6a..d4c8dd79 100644 --- a/han-plugin-builder/skills/agent-builder/SKILL.md +++ b/han-plugin-builder/skills/agent-builder/SKILL.md @@ -8,19 +8,12 @@ description: > or subagent. Does not build a skill or slash command — use skill-builder. Does not serve, vendor, or refresh the authoring guidance itself — use guidance. allowed-tools: - Read, Write, Edit, Glob, Grep, Bash(find *), Bash(mkdir *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Bash(find *), Bash(mkdir *) --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Guidance Location diff --git a/han-plugin-builder/skills/guidance/SKILL.md b/han-plugin-builder/skills/guidance/SKILL.md index 8b38bcde..64a37cd7 100644 --- a/han-plugin-builder/skills/guidance/SKILL.md +++ b/han-plugin-builder/skills/guidance/SKILL.md @@ -8,18 +8,12 @@ description: > dependency on this plugin) plus a path-scoped rule index, or `update` to refresh an already-vendored copy. Does not run an interview to build a new skill or agent from scratch — use skill-builder or agent-builder. Does not write feature code, review application code, or build non-plugin features. -allowed-tools: Read, Glob, Grep, Bash(find *), Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read, Glob, Grep, Bash(find *) --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. This skill has three modes. Pick the mode from how it was invoked, then follow only that mode's steps. diff --git a/han-plugin-builder/skills/guidance/references/skill-building-guidance/context-injection-commands.md b/han-plugin-builder/skills/guidance/references/skill-building-guidance/context-injection-commands.md index 60fd9d41..09e2fc21 100644 --- a/han-plugin-builder/skills/guidance/references/skill-building-guidance/context-injection-commands.md +++ b/han-plugin-builder/skills/guidance/references/skill-building-guidance/context-injection-commands.md @@ -136,18 +136,16 @@ This reflects the loader's current behavior. The exact allowlist can shift betwe command is not clearly a plain read-only form, prefer the simplest single-command version or move the logic into a script (next rule). -### Rule: Keep every probe reading inside the project working directory +### Rule: A probe that reads outside the project does so through a script, never in its own text -A probe reads files in the directory the skill runs from. When a step needs the content of a file somewhere else, gather -it during the run with the Read tool instead. +A probe whose text names a file outside the working directory, a home directory, a configuration directory, or +anywhere holding credentials, is the read most likely to be refused, and a refused probe takes the whole skill down +before any step runs. Put the read in a script, run the script from the probe behind an exact grant, and guard the +probe so a script that cannot run degrades to a sentinel instead of aborting. The loader then sees only the script +command, and the script's own failure is caught by the guard. -The reason is the no-prompt, no-fallback behavior from the rule above. A probe stakes the whole skill on a permission -decision it cannot recover from, and a read reaching outside the project into a home directory, a configuration -directory, or anywhere holding credentials is the read most likely to draw a refusal. A Read-tool call during the run -carries no such risk to the skill: the step handles a read that returns nothing and carries on. - -Han shipped this mistake once. Forty skills read an optional personal config through a probe pointed at the Claude Code -configuration directory, and the refusal that followed took whole skills down before they did any work: +Han shipped the probe-text form once. Forty skills read an optional personal config through a probe pointed at the +Claude Code configuration directory, and the refusal that followed took whole skills down before they did any work: ``` Error: Shell command permission check failed for pattern @@ -156,18 +154,17 @@ Permission for this action was denied by the Claude Code auto mode classifier. Reason: Blocked by classifier. ``` -Resolving a path in a probe stays fine, because `echo` opens no file. Reading through it does not. - -**Prefer (probe resolves the location, a step reads the file):** +**Prefer (a guarded script reads the file, and the probe text names only the script):** ``` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` +!`bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh" 2>/dev/null || echo "No configuration applies to this run."` ``` -That line reads an environment variable inside a script rather than in the probe text, which is the only measured way -to reach one. See "Rule: Reach an environment variable through a script, not through probe text" below. +That is how `han-core:load-han-config` reads both `.han/config.md` files today: the script resolves the personal +directory from an environment variable, which probe text cannot name (see the next rule), reads the files, and prints +them with the rule for applying them. The same shape serves any lookup many skills share. -**Avoid (probe reads outside the project):** +**Avoid (probe text reads outside the project):** ``` !`cat "$HOME/.someconfig" 2>/dev/null || echo ""` @@ -203,11 +200,11 @@ An `allowed-tools` grant does not help here. The refusal happens on the text, be To reach a variable, put it in a script and run the script from the probe: ``` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` +!`bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh" 2>/dev/null || echo "No configuration applies to this run."` ``` ```yaml -allowed-tools: Read, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh") ``` Four things make that work, and leaving any of them out aborts the skill: diff --git a/han-plugin-builder/skills/guidance/references/skill-building-guidance/graceful-degradation.md b/han-plugin-builder/skills/guidance/references/skill-building-guidance/graceful-degradation.md index 28d9529e..1cf4ecfa 100644 --- a/han-plugin-builder/skills/guidance/references/skill-building-guidance/graceful-degradation.md +++ b/han-plugin-builder/skills/guidance/references/skill-building-guidance/graceful-degradation.md @@ -99,8 +99,10 @@ defaults with Glob — but only use the default if the directory actually exists - language, framework - non-standard paths -Skills discover config inline (context injection + Read) rather than calling a data-fetch sub-skill. This avoids the -early-exit failure mode documented in `writing-effective-instructions.md`. +Skills discover project values (CLAUDE.md, project-discovery.md, paths, commands) inline through context injection +and Read. The one shared lookup, `.han/config.md`, is surfaced by the inline `han-core:load-han-config` skill under +the exception in `skill-composition.md`; a forked data-fetch sub-skill stays out, for the early-exit failure documented +in `writing-effective-instructions.md`. --- diff --git a/han-plugin-builder/skills/guidance/references/skill-building-guidance/skill-composition.md b/han-plugin-builder/skills/guidance/references/skill-building-guidance/skill-composition.md index 79e47816..2984e2c1 100644 --- a/han-plugin-builder/skills/guidance/references/skill-building-guidance/skill-composition.md +++ b/han-plugin-builder/skills/guidance/references/skill-building-guidance/skill-composition.md @@ -8,7 +8,7 @@ paths: ## Contents - Orchestration composition (supported, with care) -- Data-fetch composition (avoid) +- Forked data-fetch composition (avoid) - The `context: fork` field - Deciding which way to go @@ -20,10 +20,11 @@ Two patterns hide under the word "composition," and they behave very differently - **Orchestration composition.** A thin calling skill hands the heavy work to a called skill that drives the rest of the output, and optionally chains into another skill afterward. **Supported. Use it with the discipline below.** -- **Data-fetch composition.** A skill calls another skill just to retrieve a few values (config paths, a command, a - setting). **Avoid it. Do discovery inline instead.** The early-exit failure mode this caused is documented below and - has not been reliably fixed by any frontmatter or instruction tuning. One narrow, separately-tested exception - (surfacing a whole shared standard inline) is carved out at the end of that section. +- **Forked data-fetch composition.** A skill calls another skill under `context: fork` only to retrieve a few values + (config paths, a command, a setting). **Avoid it. Do discovery inline instead.** The early-exit failure mode this + caused is documented below and has not been reliably fixed by any frontmatter or instruction tuning. One + separately-tested exception (an inline sub-skill that surfaces shared content) is carved out at the end of that + section. Knowing which one you are reaching for is the whole decision. The rest of this document is the guidance for each. @@ -86,14 +87,16 @@ on implicit continuation. This is the single most common way an orchestration si ### Declare the Skill tool in `allowed-tools` -A skill that invokes another skill must list `Skill` in its `allowed-tools` frontmatter (both Atlassian orchestrators -do). Without it the Skill call is not permitted. +A skill that invokes another skill lists `Skill` in its `allowed-tools` frontmatter, as every Han skill that invokes +`han-core:load-han-config` does. `allowed-tools` pre-approves a tool rather than gating it, so a missing entry does not +block the call, but in a permission mode that prompts it can put a prompt in front of the invocation. The grant is +cheap; carry it. -## Data-fetch composition (avoid) +## Forked data-fetch composition (avoid) -Data-fetch composition is calling a sub-skill only to retrieve a few structured values (a docs directory, a test -command, a config setting) for the calling skill to use immediately. **Do not do this.** Discover the values inline -instead. +Forked data-fetch composition is calling a sub-skill under `context: fork` only to retrieve a few structured values (a +docs directory, a test command, a config setting) for the calling skill to use immediately. **Do not do this.** +Discover the values inline instead, or surface them through an inline sub-skill under the exception below. The failure mode is concrete and has been observed repeatedly. A forked data-fetch sub-skill (`context: fork`) returns its values, and then an `api_retry` event can fire and anchor the calling model on the sub-skill's output as if it were @@ -115,14 +118,19 @@ This eliminates the forked sub-skill entirely, and with it the `api_retry` inter ### Duplicate small discovery logic rather than sharing it through a skill If two skills both need to find the docs directory, duplicate that handful of lines in each. A small amount of -duplicated discovery logic is far more reliable than a shared data-fetch sub-skill. Reserve composition for -orchestration, where a whole substantial workflow, not a few values, is what you would otherwise be duplicating. +duplicated discovery logic is far more reliable than a shared forked sub-skill. Reserve composition for orchestration, +where a whole substantial workflow, not a few values, is what you would otherwise be duplicating. -### The one exception: surfacing a shared standard inline +The duplication has a limit. When one discovery block is copied into many skills and has had to be re-swept, surface +it through an inline sub-skill under the exception below. Han's `.han/config.md` block is the worked example: it was +copied into every skill, swept four times in two months, and one sweep missed a skill and took it down. It is now +surfaced by `han-core:load-han-config`, and each consumer carries one line. + +### The one exception: surfacing shared content inline There is a single shape that looks like data-fetch but is supported, because it was validated on its own rather than -assumed: an **inline** sub-skill that surfaces a shared _standard or reference set_ into the caller's context and then -hands control straight back for the caller to apply. The motivating case is a guidance skill that reads one canonical +assumed: an **inline** sub-skill that surfaces shared content, a _standard or reference set_ or a _shared lookup's raw +results_, into the caller's context and then hands control straight back for the caller to apply. The motivating case is a guidance skill that reads one canonical copy of a writing or review standard and surfaces it into whichever skill is about to produce output, so the standard lives in one place instead of being vendored into every plugin that needs it. @@ -135,10 +143,11 @@ Three properties separate this from the data-fetch pattern you should avoid: a deliberately final-sounding closing line, and the caller resumed and finished every time with no early exit. The forked variant of the same skill was disqualified for a separate reason: the fork isolated the guidance so its content never reached the caller. -2. **It surfaces a whole standard, not a few values.** Retrieving a docs directory or a test command is still - data-fetch; do that inline (above). This exception is for surfacing a substantial shared reference that would - otherwise be duplicated into every consumer, which is closer to orchestration's "duplicating a whole skill's worth of - work" test than to fetching a setting. +2. **It surfaces content many consumers would otherwise duplicate, and leaves interpretation to the caller.** A whole + standard qualifies, and so does a shared lookup's raw result: `han-core:load-han-config` surfaces both + `.han/config.md` files as they are, and the caller applies the config rule to them. Fetching one value for one skill + is still inline discovery (above). The test is the same one orchestration uses: would every consumer otherwise carry + a copy of this? 3. **The caller still owns and finishes its own workflow.** The sub-skill adds content to the context and returns; it does not produce the caller's deliverable. Keep an explicit "proceed to the next step" instruction after the invocation as cheap insurance, even though the spike completed without it. @@ -146,7 +155,20 @@ Three properties separate this from the data-fetch pattern you should avoid: One honest limit on that evidence: the spike could not induce a real `api_retry`, which is the specific trigger of the forked failure. The worst-case run removed the mitigation `api_retry` is said to defeat and still held, so treat this exception as reliable under adversarial same-context testing, not as proof the failure can never occur. If you reach for -it, keep the sub-skill inline, keep the continuation instruction, and use it only for a genuinely shared standard. +it, keep the sub-skill inline, keep the continuation instruction, and use it only for genuinely shared content. + +The values case was then measured on its own. A trial ran a heavy consumer through a project-skill copy of +`han-core:load-han-config` that surfaces `.han/config.md`, and then used every resolved setting: 99 same-context +trials across 15 arms, 93 of which invoked the loader +(inline, a worst-case loader ending on a final-sounding line with no caller-side guardrail, a chain of two inline +sub-skills, a depth-two call, direct invocation, a caller without a `Skill` grant in a permission mode that does not +prompt, and six configuration states), with zero early exits and every value applied as the config rule says. The record is under +`docs/plans/gh-203-consolidate-config-loading/artifacts/trial/`. The loader was then reduced to a single probe whose +script prints both files and the rule, and a second trial ran that shipped skill, installed from a local marketplace +and reached by its cross-plugin name, through 48 trials in 10 arms (the same composition shapes plus five +configuration states), again with zero early exits and every value applied; its record is under +`docs/plans/gh-203-consolidate-config-loading/artifacts/trial2/`. The same limits apply to both: no `api_retry` was +induced and one model was tested. ## The `context: fork` field @@ -163,11 +185,11 @@ Ask what you would be duplicating if you did not compose: - **A whole user-facing workflow that owns an artifact** (a planning run, a documentation pass, a publish step): compose, using the orchestration discipline above. Duplicating an entire skill is worse than the cost of a careful Skill call. -- **A few values** (paths, commands, settings): stay inline. Duplicate the small discovery logic. Do not reach for a - sub-skill. -- **A whole shared standard or reference set** that every consumer would otherwise vendor a copy of: an inline sub-skill - may surface it into the caller's context, under the narrow exception above. Keep it inline (never `context: fork`) and - keep an explicit continuation instruction after the call. +- **A few values one skill needs** (paths, commands, settings): stay inline. Duplicate the small discovery logic. Do + not reach for a sub-skill. +- **A shared lookup or standard that every consumer would otherwise carry a copy of**: an inline sub-skill may surface + it into the caller's context, under the exception above. Keep it inline (never `context: fork`), keep an explicit + continuation instruction after the call, and leave interpretation of what it surfaces to the caller. Cross-references: diff --git a/han-plugin-builder/skills/guidance/references/skill-building-guidance/troubleshooting.md b/han-plugin-builder/skills/guidance/references/skill-building-guidance/troubleshooting.md index 26212113..32cac63b 100644 --- a/han-plugin-builder/skills/guidance/references/skill-building-guidance/troubleshooting.md +++ b/han-plugin-builder/skills/guidance/references/skill-building-guidance/troubleshooting.md @@ -365,20 +365,18 @@ the refusal aborted the whole skill instead of degrading. Note the error text differs from the two failure modes below and above: it names an auto mode classifier rather than `This command requires approval`. Search on either phrase lands here. -**Fix:** Resolve the path in the probe, and read the file with the Read tool during the run. +**Fix:** Move the read into a script, run the script from the probe behind an exact grant, and guard the probe. -**Before (broken — probe reads outside the project):** +**Before (broken — probe text reads outside the project):** ```markdown - personal config: !`cat "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/.han/config.md" 2>/dev/null || echo ""` ``` -**After (correct — probe resolves the location only):** +**After (correct — the probe names only the script, which reads the file):** ```markdown -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. +!`bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh" 2>/dev/null || echo "No configuration applies to this run."` ``` The probe runs a script because naming an environment variable in probe text is refused outright. See the next section. @@ -407,11 +405,11 @@ Permission mode does not rescue it either. `default`, `plan`, `acceptEdits`, and **Fix:** Move the variable into a script and run the script from the probe, behind a grant naming that exact command. ```markdown -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` +!`bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh" 2>/dev/null || echo "No configuration applies to this run."` ``` ```yaml -allowed-tools: Read, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh") ``` See [Context Injection Commands](./context-injection-commands.md) for the measured results table and the four @@ -431,7 +429,7 @@ conditions that form has to meet. aborting: ```markdown -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` +!`bash "${CLAUDE_PLUGIN_ROOT}/scripts/load-han-config.sh" 2>/dev/null || echo "No configuration applies to this run."` ``` Verify a script probe as an installed plugin rather than as a local skill under `.claude/skills/`. `${CLAUDE_PLUGIN_ROOT}` @@ -470,16 +468,20 @@ See [Context Injection Commands](./context-injection-commands.md) for the full r **Symptom:** A skill calls another skill via the Skill tool. The sub-skill runs and produces output on screen, but the calling skill never picks up the results. -### Cause 1: Data-fetch sub-skill (forked or inline) +### Cause 1: Data-fetch sub-skill under `context: fork` -The skill calls another skill only to retrieve a few values (a config path, a command, a setting). This is unreliable in -both forms. Inline, the model has no structured return mechanism and must manually context-switch back to the parent -workflow. Forked with `context: fork`, an `api_retry` event can anchor the model on the sub-skill's returned output and -bypass every remaining step, the early-exit failure documented in [Skill Composition](./skill-composition.md). +The skill calls another skill only to retrieve a few values (a config path, a command, a setting) and runs it with +`context: fork`. An `api_retry` event can then anchor the model on the sub-skill's returned output and bypass every +remaining step, the early-exit failure documented in [Skill Composition](./skill-composition.md). Inline, the sub-skill +renders into the caller's context and returns no value to anchor on; the OI-3 spike ran 34 same-context invocations +with zero early exits (commit 8c96157). That evidence covers surfacing a shared standard. A values-only inline sub-skill, a trial copy of +`han-core:load-han-config`, then held across 93 loader invocations, and the shipped loader across 48 more, with zero early exits (see Skill +Composition). -**Fix:** Do not use a data-fetch sub-skill at all. Discover the values inline: detect config files via context -injection, Read them directly in the skill's own steps, and fall back to conventional defaults. Duplicate the handful of -discovery lines rather than sharing them through a sub-skill. +**Fix:** Do not fork a data-fetch sub-skill. Discover the values inline: detect config files via context injection, +Read them directly in the skill's own steps, and fall back to conventional defaults. Duplicate a handful of discovery +lines rather than sharing them through a forked sub-skill. For content many skills would otherwise duplicate, see the +inline exception in [Skill Composition](./skill-composition.md). ### Cause 2: Orchestration sub-skill, but the orchestrator lost its workflow @@ -501,8 +503,9 @@ explicit instruction to proceed to the next step. Never rely on implicit continu 6. **AskUserQuestion fails:** Remove it from `allowed-tools` — the bug causes silent failures when auto-approved 7. **Context injection in prose:** Never use the literal bang-backtick pattern in SKILL.md body text — the loader parses raw text and tries to execute it -8. **Sub-skill output lost:** Replace data-fetch sub-skills with inline discovery; for orchestration sub-skills, keep - the orchestrator thin and instruct it to proceed explicitly after the Skill call +8. **Sub-skill output lost:** Replace forked data-fetch sub-skills with inline discovery, or with an inline sub-skill + under Skill Composition's exception; for orchestration sub-skills, keep the orchestrator thin and instruct it to + proceed explicitly after the Skill call Cross-references: diff --git a/han-plugin-builder/skills/guidance/references/skill-building-guidance/writing-effective-instructions.md b/han-plugin-builder/skills/guidance/references/skill-building-guidance/writing-effective-instructions.md index 203de01c..6d5b7734 100644 --- a/han-plugin-builder/skills/guidance/references/skill-building-guidance/writing-effective-instructions.md +++ b/han-plugin-builder/skills/guidance/references/skill-building-guidance/writing-effective-instructions.md @@ -215,8 +215,9 @@ plus test, lint, and build commands; fall back to project-discovery.md; fall bac The skill reads config files directly using Read — no forked sub-skill, no `api_retry` interaction, no early-exit risk. -This rule applies to data-fetch sub-skills that return structured values. Orchestration sub-skills (where the called -skill drives the remaining output) are unaffected. +This rule applies to forked data-fetch sub-skills. Orchestration sub-skills (where the called skill drives the +remaining output) are unaffected, and so is an inline sub-skill that surfaces shared content under the exception in +[Skill Composition](./skill-composition.md), the shape `han-core:load-han-config` uses for `.han/config.md`. ### Rule: Reference bundled resources clearly diff --git a/han-plugin-builder/skills/guidance/scripts/init-guidance.sh b/han-plugin-builder/skills/guidance/scripts/init-guidance.sh index ea7d9b37..089f4dce 100755 --- a/han-plugin-builder/skills/guidance/scripts/init-guidance.sh +++ b/han-plugin-builder/skills/guidance/scripts/init-guidance.sh @@ -47,7 +47,9 @@ RULE=".claude/rules/plugin-building-guidance.md" # "agent-building-guidelines" directory names, which diverge at "building". The # guidance command reference ("use guidance.") and the guidance docs path # (${CLAUDE_PLUGIN_ROOT}/skills/guidance/references/, only set when the plugin is -# installed) are retargeted at the renamed, vendored guidance skill. +# installed) are retargeted at the renamed, vendored guidance skill. The one-line +# han-core:load-han-config instruction is dropped: a vendored copy runs with no +# plugin installed, so it runs with no configuration, like the portable guidance skill. rewrite_skill() { file="$1" tmp="$(mktemp)" @@ -61,6 +63,7 @@ rewrite_skill() { -e 's|skill-builder|plugin-skill-builder|g' \ -e 's|agent-builder|plugin-agent-builder|g' \ -e 's|use guidance\.|use plugin-guidance.|g' \ + -e '/^Resolve configuration with `han-core:load-han-config` if you have not already this run\.$/d' \ "$file" > "$tmp" mv "$tmp" "$file" } diff --git a/han-plugin-builder/skills/skill-builder/SKILL.md b/han-plugin-builder/skills/skill-builder/SKILL.md index 328d0877..647baf89 100644 --- a/han-plugin-builder/skills/skill-builder/SKILL.md +++ b/han-plugin-builder/skills/skill-builder/SKILL.md @@ -8,19 +8,12 @@ description: > build an agent or subagent — use agent-builder. Does not serve, vendor, or refresh the authoring guidance itself — use guidance. allowed-tools: - Read, Write, Edit, Glob, Grep, Bash(find *), Bash(mkdir *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Bash(find *), Bash(mkdir *) --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Guidance Location diff --git a/han-reporting/.claude-plugin/plugin.json b/han-reporting/.claude-plugin/plugin.json index 3be3d23c..c1f939a9 100644 --- a/han-reporting/.claude-plugin/plugin.json +++ b/han-reporting/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "han-reporting", - "description": "Reporting and summary skills for the Han suite. Turns feature specifications into plain-language stakeholder summaries (also called executive or business summaries) with diagrams, for sharing with non-technical stakeholders before implementation kicks off.", + "description": "Reporting and summary skills for the Han suite. Turns feature specifications into plain-language stakeholder summaries (also called executive or business summaries) with diagrams, for sharing with non-technical stakeholders before implementation kicks off. Depends on han-communication and han-core.", "version": "2.2.2", - "dependencies": ["han-communication"] + "dependencies": ["han-communication", "han-core"] } diff --git a/han-reporting/README.md b/han-reporting/README.md index e7804786..f5fd719a 100644 --- a/han-reporting/README.md +++ b/han-reporting/README.md @@ -5,7 +5,7 @@ stakeholders. It converts a feature specification into a plain-language stakehol single self-contained HTML executive report. Reach for it when you need buy-in or feedback from people who will not read the spec. -**Bundled.** Installed with the `han` meta-plugin. Depends on `han-communication`. +**Bundled.** Installed with the `han` meta-plugin. Depends on `han-communication` and `han-core`. **Getting started:** the skills chain. Run [`/stakeholder-summary`](docs/skills/stakeholder-summary.md) to produce the summary, then [`/html-summary`](docs/skills/html-summary.md) to turn that summary into a shareable HTML report. diff --git a/han-reporting/references/config-rule.md b/han-reporting/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-reporting/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-reporting/scripts/han-config-dir.sh b/han-reporting/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-reporting/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-reporting/skills/html-summary/SKILL.md b/han-reporting/skills/html-summary/SKILL.md index 9ba07767..9b70204b 100644 --- a/han-reporting/skills/html-summary/SKILL.md +++ b/han-reporting/skills/html-summary/SKILL.md @@ -7,18 +7,12 @@ description: > report, generate an HTML version of a summary doc, or produce a shareable HTML file from a summary markdown. Produces an HTML sibling file only; does not publish anything. argument-hint: "[path to stakeholder-summary.md]" -allowed-tools: Read, Write, Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read, Write --- ## Project Context -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` - -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. # HTML Summary diff --git a/han-reporting/skills/stakeholder-summary/SKILL.md b/han-reporting/skills/stakeholder-summary/SKILL.md index f9780c69..e9cd614a 100644 --- a/han-reporting/skills/stakeholder-summary/SKILL.md +++ b/han-reporting/skills/stakeholder-summary/SKILL.md @@ -8,21 +8,15 @@ description: > plan-implementation. argument-hint: "[path to feature-specification.md, optional: extra context for the summary]" allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, Bash(find *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles diff --git a/han-research/references/config-rule.md b/han-research/references/config-rule.md deleted file mode 100644 index 5c16a2a5..00000000 --- a/han-research/references/config-rule.md +++ /dev/null @@ -1,159 +0,0 @@ -# Config Rule (`.han/config.md`) - -## Contents - -- The two files, the two probes, and the personal read -- Schema -- How a configured path resolves -- Precedence -- Extra agents joining the pool -- Degradation and the one-line note - -Han reads two optional configuration files, and either one may be absent. A person may carry a personal -`.han/config.md` inside their Claude Code configuration directory, and a consuming project may carry its own -`.han/config.md`. The personal file supplies defaults that follow the person into every project; the project file -adjusts them for that project. Each participating skill finds both through its `## Project Context` block; this rule -defines how every skill interprets what that block yields, so one pair of files resolves identically across the whole -suite. Every vendored copy of this file is byte-identical to the canonical `han-core/references/config-rule.md`. - -## The two files, the two probes, and the personal read - -The `## Project Context` block carries two probe lines and directs one Read-tool call. This rule refers to each by the -label it injects under, or by the file it reads. - -- `personal config directory` (probe): the Claude Code configuration directory, resolved for this run. Named by the - `CLAUDE_CONFIG_DIR` environment variable when that variable is set, and `~/.claude` when it is not. This value is not - a setting. It is the folder a relative path in the personal file resolves against. -- The personal `.han/config.md` (Read tool): the content of `.han/config.md` inside that directory, or nothing. The - skill reads this file itself as its first action rather than through a probe. A probe runs at skill load, where it - cannot prompt and cannot degrade, so a permission decision against it aborts the skill instead of falling back to - defaults. The personal file is the one lookup that reaches outside the project, so it is the one lookup a probe - cannot safely carry. -- `project .han/config.md` (probe): the content of `.han/config.md` in the directory the skill is running from, or - nothing. - -The two directories can both exist on one machine and point at different places, so the variable wins whenever it is -set. A personal file sitting in `~/.claude/.han/config.md` does not apply to a person who has pointed -`CLAUDE_CONFIG_DIR` somewhere else. - -Neither lookup walks up the directory tree. The project file is found only in the directory the skill runs from, the -same place the CLAUDE.md and project-discovery probes look. A config elsewhere in the repository does not apply. When -neither lookup yields content, no config is present: behave exactly as the skill does without this rule, with no note. - -When both lookups resolve to the same file, because the skill is running inside the Claude Code configuration -directory, read it once and treat it as the project configuration. Nothing is counted twice, and its `## Extra Agents` -list is one list. - -## Schema - -Each file is markdown: optional YAML frontmatter for scalar settings, then named sections for list settings. Both files -carry the same settings under the same names, so moving a setting from one file to the other changes nothing but the -file it sits in. - -- `output-directory` (frontmatter key): a base path under which the skill writes its markdown deliverables while - keeping its own folder and file structure beneath it. Create the directory on first write when it does not exist. -- `default-swarm-size` (frontmatter key): the default size band for skills that classify a swarm or team size before - dispatching agents. Accepted values, trimmed of surrounding whitespace and matched case-insensitively: `small`, - `medium`, `large`, `dynamic`. A value of `small`, `medium`, or `large` is adopted exactly as if the user had passed - it as the skill's size argument: the skill skips its signal-based classification, scales its caps to the band, and - announces the band naming which file supplied it. Specialists are still selected by signal within the band's caps. - `dynamic`, or an absent setting, leaves the skill classifying the size itself from the work's signals, with no - mention of the config. Explicit user input outranks the setting per the precedence chain, and `dynamic` is also a - valid explicit size input that forces signal-based classification for that run. An unrecognized size argument (a - typo) supplies no explicit value, so the configured band still applies. A skill that dispatches no agent swarm - ignores the setting silently. -- `writing-voice` (frontmatter key): a file path naming the writing-voice profile the readability skills apply in place - of the built-in profile at `han-communication/references/writing-voice.md`. An absent or blank setting keeps the - built-in profile. When a value is present, verify the file exists before using it. When it exists, that file is the - writing-voice profile for the run, including the vocabulary blocklist the readability rule points to. When it does - not exist, do not degrade silently: warn the user that the configured writing-voice file was not found, name which - file configured it, and ask whether to use the built-in Han voice or skip the writing voice entirely for the run. - Skipping means the run applies the readability rule with no voice profile and no vocabulary blocklist. A skill that - produces no prose deliverable ignores the setting silently. -- `## Extra Agents` (section heading): one agent per list line, in qualified `plugin:agent` form or bare-name form. - Match names case-insensitively against the agents available in the session. -- `## Code Review Types` and `## Code Review Type Agents` (section headings): list settings owned by the code-review - skill, which defines their line format and how it uses them. Every other skill ignores both silently. - -## How a configured path resolves - -`output-directory`, `writing-voice`, and each path listed under `## Code Review Types` name a path, and all resolve the same way. - -- **A relative path resolves against the folder holding the file that declared it.** A relative path in the project - file resolves against the working directory. A relative path in the personal file resolves against the - `personal config directory` value the probe supplied. This is what lets one personal writing-voice profile, kept - beside the personal config, apply in every project. -- **A full path is used as it stands**, including one that points outside the project. -- **A leading `~` expands to the home directory before the value is used.** Resolve it in the run rather than leaving - it to a shell, because most skills have no shell available to them. The Read tool does expand a leading `~`, but - always to the home directory, never to a configured directory somewhere else, so a value meant to sit beside the - personal config must not rely on it. `..` segments are likewise accepted and resolved. - -No path is refused for pointing outside the project. A skill that writes deliverables to a configured -`output-directory` outside the working directory does so without comment; the person who configured it chose that. - -## Precedence - -Resolve each scalar setting through this fixed chain; the first source that supplies a usable value wins: - -1. Explicit user input to the skill, including an explicit output path passed by a calling skill. -2. The project `.han/config.md`. -3. The personal `.han/config.md`. -4. The CLAUDE.md `## Project Discovery` section. -5. The project-discovery file. -6. The skill's built-in defaults. - -Resolution is per setting, not per file. The project file's value is used only for the settings the project file names, -so a project file naming one setting leaves every other personal setting in place. A recognized setting whose value in -the project file is blank or unusable is not a value, so that setting falls through to the personal file rather than to -the skill's default. - -The extra-agents list adds rather than replaces: agents the user names explicitly are always considered, and both -files' entries join them as candidates. - -A keyed list setting, where each line names a key such as a review type, resolves per key. When both files name the -same key, the project file's line is used; when that line is unusable, the personal file's line for the same key is -used. Lines with different keys are all kept. `## Code Review Type Agents` lines add together across both files, as -`## Extra Agents` entries do. - -## Extra agents joining the pool - -A skill that selects among candidate agents adds both files' extra agents to its candidate pool. They compete under the -skill's own signal-based selection and size caps; a selected extra agent may take a slot a default specialist would -otherwise have filled, and that displacement happens without comment. An entry that duplicates an agent already in the -pool has no effect, whether the duplicate comes from the same file or the other one: the agent is one candidate, -counted once against the caps. An entry that does not resolve to a dispatchable agent is skipped with the one-line note -naming it. A skill may consider the list on only some of its runs; when it does, its own instructions say which. - -## Degradation and the one-line note - -A bad config never fails a skill run, with two exceptions. A `writing-voice` value naming a file that does not exist -asks the user which fallback to take, per its definition above. A review type the user invokes by name, whose -configured file is missing or incomplete, stops that code review before it starts, as the code-review skill defines. -Otherwise the worst a bad config can do is be ignored. Show a one-line note only when content that attempts a -recognized override cannot be used; pass over everything else silently. - -**Every message about configuration names which of the two files it came from**, on the failure path and the success -path alike. That includes the announcement a sizing skill makes when it adopts a configured band. The two files share a -name, so a message that omits which one leaves the reader opening both. - -- Malformed frontmatter, or a file unreadable as text: ignore the unusable portion, resolve those settings from the - rest of the precedence chain, and note what was ignored and which file held it. -- The `personal config directory` probe reporting the home directory when `CLAUDE_CONFIG_DIR` names somewhere else: - the probe runs a resolver script, and its guard falls back to the home directory if that script is missing or fails. - Nothing detects this, and no note is shown, because the probe cannot tell a failed resolution from a person who never - set the variable. The personal file at the configured location stops applying until the script is restored. -- A setting name the suite does not recognize: ignore it with a note; recognized settings in the same file still apply. -- A recognized setting with a blank or unusable value: ignore it with a note and fall through the precedence chain. -- A setting that does not apply to the running skill (it writes no markdown deliverable, or selects no agents): ignore - it silently. -- A file holding only prose the suite has no use for: behave as if the file were absent, with no note. -- A personal configuration directory the run cannot reach: treat it as no personal configuration, with no note. A run - cannot tell that apart from a person who never wrote the file, and the second group is far larger. -- A personal `.han/config.md` the Read tool cannot return, whether it is absent, unreachable, or refused: treat it as - no personal configuration, with no note, for the same reason. This covers the read failing to produce a file at all. - A file that reads but cannot be used is a different case and keeps the note its own bullet above describes. - -One problem gets one note. Two separate problems, one in each file, get two notes, because each names a different thing -to go and fix. The note is one line naming what was ignored, which file it came from, and why, shown on each run where -the problem is present. When everything applies cleanly, say nothing about the config. diff --git a/han-research/scripts/han-config-dir.sh b/han-research/scripts/han-config-dir.sh deleted file mode 120000 index 38e3d03c..00000000 --- a/han-research/scripts/han-config-dir.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/han-config-dir.sh \ No newline at end of file diff --git a/han-research/skills/gap-analysis/SKILL.md b/han-research/skills/gap-analysis/SKILL.md index f9447527..f7676f7f 100644 --- a/han-research/skills/gap-analysis/SKILL.md +++ b/han-research/skills/gap-analysis/SKILL.md @@ -10,21 +10,15 @@ arguments: size argument-hint: "[size: small | medium | large | dynamic] [current state artifact, desired state artifact, optional: scope and modes]" allowed-tools: - Read, Write, Glob, Grep, Agent, Bash(find *), Bash(git *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Glob, Grep, Agent, Bash(find *), Bash(git *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -197,7 +191,7 @@ from: Extra agents named in the project config's `## Extra Agents` list join this domain-specialist pool and compete under the same gap-driven selection and size caps, per -[../../references/config-rule.md](../../references/config-rule.md): add one only when a gap touches its stated +the config rule `han-core:load-han-config` surfaced: add one only when a gap touches its stated specialty, count it against the size cap, and skip an entry that does not resolve to a dispatchable agent with a one-line note. @@ -217,7 +211,7 @@ example: argument), use it: a band value is the size and skips the signal-based classification above, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is empty and the project config supplies a band via `default-swarm-size` (per the config rule in -[../../references/config-rule.md](../../references/config-rule.md)), use that band, skip the signal-based +the config rule `han-core:load-han-config` surfaced), use that band, skip the signal-based classification, and announce the config as the source. The swarm composition still scales to the chosen size. If the user named specific specialists, honor those. If the user requested a different size in conversation rather than via `$size`, accept the override. diff --git a/han-research/skills/issue-triage/SKILL.md b/han-research/skills/issue-triage/SKILL.md index 7ab4f7d6..d1a2ec80 100644 --- a/han-research/skills/issue-triage/SKILL.md +++ b/han-research/skills/issue-triage/SKILL.md @@ -7,20 +7,15 @@ description: > paths — use investigate for debugging, diagnosis, and root cause analysis. Does not plan features or build solutions — use plan-a-feature or plan-implementation for that. argument-hint: "[issue text, bug report, or path to a report file; optional output path]" -allowed-tools: Read, Write, Bash(find *), Bash(mkdir *), Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +allowed-tools: Skill, Read, Write, Bash(find *), Bash(mkdir *) --- ## Project Context - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Triage Approach diff --git a/han-research/skills/research/SKILL.md b/han-research/skills/research/SKILL.md index 095ab716..6b948b01 100644 --- a/han-research/skills/research/SKILL.md +++ b/han-research/skills/research/SKILL.md @@ -14,8 +14,7 @@ argument-hint: '[size: small | medium | large | dynamic] [the open-ended question to research] [optional output path] [optional: "evidence optional" / "exploratory" to relax the evidence requirement]' allowed-tools: - Read, Write, Edit, Glob, Grep, Agent, WebSearch, WebFetch, Bash(find *), - Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") + Skill, Read, Write, Edit, Glob, Grep, Agent, WebSearch, WebFetch, Bash(find *) --- ## Project Context @@ -23,13 +22,8 @@ allowed-tools: - git installed: !`which git 2>/dev/null || echo "not installed"` - CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` - project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` -- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` -- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` -As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read -that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` -probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence -between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. +Resolve configuration with `han-core:load-han-config` if you have not already this run. ## Operating Principles @@ -146,7 +140,7 @@ smaller. **Apply the size override.** If `$size` is not `none provided`, use it: a band value is the band and skips the signal-based classification, while `dynamic` forces the signal-based classification even when the project config sets a default band. If `$size` is `none provided` and the project config supplies a band via `default-swarm-size` (per the -config rule in [../../references/config-rule.md](../../references/config-rule.md)), use that band, skip the +config rule `han-core:load-han-config` surfaced), use that band, skip the signal-based classification, and announce the config as the source. In every case still pick angles by signal (a `large` band does not run a codebase angle when there is no codebase, or an option-comparison angle when there are no options). A conversational override ("research this broadly") is equivalent to `$size`. @@ -176,7 +170,7 @@ option cluster plus `han-core:codebase-explorer`, then `han-core:adversarial-val option-comparison angle is skipped entirely for questions with no discrete alternatives. Extra agents named in the project config's `## Extra Agents` list join the candidate pool and compete under the same -signal-based selection and band caps, per [../../references/config-rule.md](../../references/config-rule.md): add one +signal-based selection and band caps, per the config rule `han-core:load-han-config` surfaced: add one only when its stated specialty bears on the question, count it against the band's cap, and skip an entry that does not resolve to a dispatchable agent with a one-line note. diff --git a/scripts/han-config-dir.bats b/scripts/han-config-dir.bats deleted file mode 100755 index 017d641f..00000000 --- a/scripts/han-config-dir.bats +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bats -# -# Guards the config-directory probe. The command that resolves the personal -# config directory appears twice in every skill that uses it: once in the -# allowed-tools grant and once in the probe. A grant that stops matching its -# probe aborts the skill silently, so these checks keep the two in step and -# keep the script they name reachable from each plugin. - -REPO_ROOT="${BATS_TEST_DIRNAME}/.." -SCRIPT_REL='scripts/han-config-dir.sh' -# The grant and probe are literal SKILL.md text, matched byte for byte, so the -# single quotes are deliberate: nothing inside them may expand here. -# shellcheck disable=SC2016 -GRANT='Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh")' -# shellcheck disable=SC2016 -PROBE='- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"`' - -# Every SKILL.md that carries the probe, one per line. -probe_skills() { - cd "$REPO_ROOT" || return 1 - grep -rlF -- "${SCRIPT_REL}\" 2>/dev/null" ./*/skills/*/SKILL.md -} - -@test "the shared resolver script exists and is executable" { - [ -x "${REPO_ROOT}/${SCRIPT_REL}" ] -} - -@test "the resolver honors CLAUDE_CONFIG_DIR when it is set" { - run env CLAUDE_CONFIG_DIR=/tmp/probe-fixture bash "${REPO_ROOT}/${SCRIPT_REL}" - [ "$status" -eq 0 ] - [ "$output" = "/tmp/probe-fixture" ] -} - -@test "the resolver falls back to the home directory when the variable is unset" { - run env -u CLAUDE_CONFIG_DIR HOME=/tmp/probe-home bash "${REPO_ROOT}/${SCRIPT_REL}" - [ "$status" -eq 0 ] - [ "$output" = "/tmp/probe-home/.claude" ] -} - -@test "at least one skill carries the probe" { - run probe_skills - [ "$status" -eq 0 ] - [ -n "$output" ] -} - -@test "every skill carrying the probe uses the exact guarded form" { - cd "$REPO_ROOT" || return 1 - for skill in $(probe_skills); do - grep -qF -- "$PROBE" "$skill" || { - echo "probe line does not match the canonical form in: $skill" - return 1 - } - done -} - -@test "every skill carrying the probe grants the same command" { - cd "$REPO_ROOT" || return 1 - for skill in $(probe_skills); do - grep -qF -- "$GRANT" "$skill" || { - echo "allowed-tools is missing the matching grant in: $skill" - return 1 - } - done -} - -@test "every plugin holding such a skill can reach the resolver script" { - cd "$REPO_ROOT" || return 1 - for skill in $(probe_skills); do - plugin="${skill#./}" - plugin="${plugin%%/*}" - [ -f "${plugin}/${SCRIPT_REL}" ] || { - echo "missing or unresolvable ${plugin}/${SCRIPT_REL} for: $skill" - return 1 - } - done -} diff --git a/scripts/han-config-dir.sh b/scripts/han-config-dir.sh deleted file mode 100755 index 27a6efb5..00000000 --- a/scripts/han-config-dir.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Prints the Claude Code configuration directory for this run. -set -euo pipefail -printf '%s\n' "${CLAUDE_CONFIG_DIR:-$HOME/.claude}" diff --git a/test/codex-packaging.bats b/test/codex-packaging.bats index 19f5eaad..e0c165ad 100755 --- a/test/codex-packaging.bats +++ b/test/codex-packaging.bats @@ -14,8 +14,8 @@ # The older shell is the local one, so CI will not catch a bash 4+ feature: # keep to bash 3.2 (no mapfile, no declare -A, no ${x^^}, no globstar). # Grep one named file, never -r: BSD grep follows symlinks during a -# recursive search and GNU grep does not, and this repo has thirteen -# root-escaping symlinks at han-*/scripts/han-config-dir.sh. +# recursive search and GNU grep does not, and this repo has carried +# root-escaping symlinks before (han-*/scripts/han-config-dir.sh). # # The catalog greps match Prettier's byte formatting: one space after each # colon, one key per line. .pre-commit-config.yaml gives Prettier ownership