Skip to content

feat(skills): hook every framework skill into override-consultation protocol - #39

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:feat/skills-override-consultation-hook
May 3, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:feat/skills-override-consultation-hook

Conversation

@potiuk

@potiuk potiuk commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Wire every existing framework skill into the agentic-override protocol that landed in #38. Each of the 15 framework skills (excluding setup-steward itself) now carries an ## Adopter overrides section that opts the skill into the run-time consultation pattern.

What changed in each skill

A standard block was inserted right before the first ## section (after the detail-files table where present, before ## Golden rules / ## Inputs / ## Prerequisites):

## Adopter overrides

Before running the default behaviour documented below, this
skill consults
[`.apache-steward-overrides/<skill-name>.md`](../../../docs/setup/agentic-overrides.md)
in the adopter repo if it exists, and applies any
agent-readable overrides it finds. See
[`docs/setup/agentic-overrides.md`](../../../docs/setup/agentic-overrides.md)
for the contract — what overrides may contain, hard rules,
the reconciliation flow on framework upgrade, upstreaming
guidance.

**Hard rule**: agents NEVER modify the snapshot under
`<adopter-repo>/.apache-steward/`. Local modifications go in
the override file. Framework changes go via PR to
`apache/airflow-steward`.

The bracketed link target carries the specific skill's name (e.g. pr-management-triage.md for the pr-management-triage skill), so adopter overrides land in the right file by convention.

Skills updated (15)

Setup family Security family PR-management family
setup-isolated-setup-install security-issue-import pr-management-code-review
setup-isolated-setup-update security-issue-import-from-md pr-management-stats
setup-isolated-setup-verify security-issue-import-from-pr pr-management-triage
setup-shared-config-sync security-issue-invalidate
security-issue-sync
security-cve-allocate
security-issue-deduplicate
security-issue-fix

Not updated: setup-steward — it is the bootstrap that manages the override mechanism. Overriding it would create a chicken-and-egg loop.

Test plan

  • All prek run --all-files hooks pass (markdownlint, typos, doctoc, check-placeholders)
  • Every framework skill except setup-steward has the ## Adopter overrides section (visual grep)
  • Each section's link target carries the correct per-skill filename
  • Reviewer eyeballs the wording for tone consistency across all 15 skills
  • CI link-check (lychee) passes

Out of scope

  • Framework-skill content actually applying override files at run-time. The framework's skills are agentic markdown; the hook is a documented convention, not a runtime injector. The contract is: a skill that has the ## Adopter overrides section commits to consulting the file. Future tooling (e.g. a sentinel pre-flight check or a hooks-from-skills mechanism) can enforce mechanically; for now, the convention is binding via the published contract.
  • The apache/airflow re-adoption using the new mechanism (PR-C) — separate PR after this lands.

🤖 Generated with Claude Code

…rotocol

Each of the 15 framework skills (excluding setup-steward, the
bootstrap that is itself the override-management mechanism)
now declares an `## Adopter overrides` section that pins the
skill into the agentic-overrides protocol documented in
docs/setup/agentic-overrides.md.

The standard block in every skill:

  ## Adopter overrides

  Before running the default behaviour documented below, this
  skill consults
  [`.apache-steward-overrides/<skill-name>.md`](../../../docs/setup/agentic-overrides.md)
  in the adopter repo if it exists, and applies any
  agent-readable overrides it finds. See
  [`docs/setup/agentic-overrides.md`](../../../docs/setup/agentic-overrides.md)
  for the contract — what overrides may contain, hard rules,
  the reconciliation flow on framework upgrade, upstreaming
  guidance.

  **Hard rule**: agents NEVER modify the snapshot under
  `<adopter-repo>/.apache-steward/`. Local modifications go in
  the override file. Framework changes go via PR to
  `apache/airflow-steward`.

Skills updated (15):

  setup-isolated-setup-install         security-issue-import
  setup-isolated-setup-update          security-issue-import-from-md
  setup-isolated-setup-verify          security-issue-import-from-pr
  setup-shared-config-sync             security-issue-invalidate
                                        security-issue-sync
  pr-management-code-review            security-cve-allocate
  pr-management-stats                  security-issue-deduplicate
  pr-management-triage                 security-issue-fix

Skill not updated:

  setup-steward — the bootstrap skill is itself the
  override-management mechanism. Overriding it would create
  a chicken-and-egg.

Per-skill substitution: the bracketed link target carries the
specific skill name (e.g. `pr-management-triage.md` for the
pr-management-triage skill), so adopter overrides land in the
right file by convention.

Insertion site is the line immediately before the first `##`
section in each SKILL.md — after the detail-files table where
present, before any `## Golden rules` / `## Inputs` /
`## Prerequisites` section. doctoc TOCs regenerated.

Generated-by: Claude Code (Claude Opus 4.7)
@potiuk
potiuk merged commit 84852ca into apache:main May 3, 2026
7 checks passed
potiuk added a commit that referenced this pull request May 4, 2026
…ft detection (#40)

Rewrite setup-steward to support three install methods, split
the lock file into committed (project pin) and local
(per-machine fetch), and drive every framework-skill invocation
through a drift check that compares the two locks.

Three install methods (copy-pasteable recipes in
docs/setup/install-recipes.md)

- svn-zip: signed zip from ASF dist
  (`https://dist.apache.org/repos/dist/release/<project>/`),
  the canonical ASF release distribution path. Verified via
  SHA-512 + OpenPGP. Recommended for production once the
  framework ships official releases.
- git-tag: pinned to a specific git tag — frozen by tag.
- git-branch: tracks a branch tip (default: main) — the WIP
  path during pre-release.

Each recipe is a single shell block: adds the right gitignore
entries, downloads + verifies + extracts, copies the
setup-steward skill into the adopter's skills dir (matching the
flat or double-symlinked convention), and tells the user to
follow /setup-steward from there.

Lock-file split

- .apache-steward.lock (committed) — the project's pin: method,
  url, ref, plus a verification anchor (commit SHA for tag,
  sha512 for zip). Edited only by /setup-steward; bumping it is
  a deliberate project-level commit.
- .apache-steward.local.lock (gitignored) — what THIS machine
  actually fetched: source_method, source_url, source_ref,
  fetched_commit, fetched_at. Per-developer, per-checkout.

Drift detection

Every framework skill (and /setup-steward verify) compares the
local lock to the committed lock at the top of its run. On
mismatch:

- Method or URL differ → ✗ full re-install
- Ref differs (project bumped tag, or git-branch local is
  behind upstream) → ⚠ sync
- svn-zip SHA-512 differs from the committed anchor → ✗
  security-flagged; investigate before upgrading

The proposal is always /setup-steward upgrade. On user OK,
upgrade:

1. Deletes the gitignored snapshot outright.
2. Re-installs per the committed lock.
3. Refreshes gitignored framework-skill symlinks (adds new
   skills, removes renamed-away ones).
4. Reconciles agentic overrides against the new framework
   structure (surfaces conflicts; never auto-rewrites).
5. Updates the local lock.

Changes

- Rewrite setup-steward/SKILL.md, adopt.md, upgrade.md,
  verify.md to express the new model.
- New: docs/setup/install-recipes.md with the three
  copy-pasteable recipes + explanatory framing.
- README's Adopting the framework section split into
  Bootstrap (shell) + Skill takeover + Subsequent
  contributors + Drift detection.

Out of scope (follow-up): wire the drift check into each
framework skill's pre-flight section (alongside the
override-consultation hook from #39). 15 skills to touch;
mechanical, deferred to keep this PR focused on the
mechanism.

Generated-by: Claude Code (Claude Opus 4.7)
potiuk added a commit that referenced this pull request May 4, 2026
#41)

Mirror of #39's override-consultation hook for the new
drift-detection mechanism that landed in #40. Every framework
skill (excluding setup-steward, which IS the drift mechanism)
now declares a `## Snapshot drift` section right after its
`## Adopter overrides` section.

The standard block in every skill:

  ## Snapshot drift

  Also at the top of every run, this skill compares the
  gitignored `.apache-steward.local.lock` (per-machine
  fetch) against the committed `.apache-steward.lock` (the
  project pin). On mismatch the skill surfaces the gap and
  proposes [`/setup-steward upgrade`]. The proposal is
  non-blocking — the user may defer if they want to run with
  the local snapshot for now.

  Drift severity:
    - method or URL differ        → ✗ full re-install
    - ref differs                 → ⚠ sync needed
    - svn-zip SHA-512 mismatches  → ✗ security-flagged

15 skills updated:

  setup-isolated-setup-install         security-issue-import
  setup-isolated-setup-update          security-issue-import-from-md
  setup-isolated-setup-verify          security-issue-import-from-pr
  setup-shared-config-sync             security-issue-invalidate
                                        security-issue-sync
  pr-management-code-review            security-cve-allocate
  pr-management-stats                  security-issue-deduplicate
  pr-management-triage                 security-issue-fix

Skill not updated:

  setup-steward — IS the bootstrap + upgrade + verify +
  override-management skill; the drift check it would
  perform is the same one its `verify` sub-action exposes.

The hook is documented behaviour, not runtime injection. A
skill that has the `## Snapshot drift` section commits to
performing the check when invoked. Future tooling can enforce
mechanically; for now the convention is binding via the
published contract.

Generated-by: Claude Code (Claude Opus 4.7)
potiuk added a commit that referenced this pull request May 4, 2026
…to framework PR (#43)

New framework skill that walks an adopter through promoting a
local `.apache-steward-overrides/<skill>.md` file into a PR
against `apache/airflow-steward`. Closes the loop on the
override mechanism: overrides start out as adopter-local
modifications (per #38 + #39), and when one stops being
project-specific and starts looking like a missing feature,
this skill is the path to upstream it.

Walkthrough

Step 0 — Pre-flight (adopter has overrides + snapshot is
        current + framework clone available)
Step 1 — Pick the override (auto-pick when only one;
        prompt when multiple)
Step 2 — Read the override + the framework skill it modifies
Step 3 — Decide if upstreamable. Four buckets:
          - project-specific  → STOP (keep as override)
          - missing feature   → continue
          - better default    → continue
          - refactor a step   → continue
Step 4 — Design the framework-level abstraction. Four
        possible shapes (config knob / change default /
        new optional step / refactor existing step)
Step 5 — Implement in user's apache-steward clone, run
        framework pre-commit
Step 6 — Confirm + open PR (assistant proposes, user fires)
Step 7 — Surface post-merge cleanup pointer (after merge
        + /setup-steward upgrade, delete the override file)

Golden rules

1. Not every override should be upstreamed.
2. Write to the framework clone, never to the gitignored
   snapshot.
3. Assistant proposes, user fires (clone, branch, commit,
   push, PR — every state-changing action confirmed first).
4. Decouple PR open from override deletion (the cleanup
   happens AFTER the PR merges, not preemptively).

Includes the standard pre-flight blocks per the framework's
conventions:

- ## Adopter overrides — consults
  .apache-steward-overrides/setup-override-upstream.md
  (per #39).
- ## Snapshot drift — compares local lock vs committed
  lock (per #41), with a doubly-important note: the skill
  designs against the snapshot's framework code, so stale
  snapshot leads to wrong abstraction design.

Generated-by: Claude Code (Claude Opus 4.7)
@andreahlert andreahlert added the mode:platform Substrate / infra — not a mode (sandbox, CI, validators) label May 7, 2026
@potiuk potiuk added capability:fix Implement code change to resolve an issue capability:intake Import external signal + sync tracker state capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) capability:resolve Close-out: invalidate, dedupe, CVE allocate, announcement capability:review Deep per-item code review or contributor mentoring capability:stats Read-only dashboards, metrics, governance evidence capability:triage Sweep + classify + propose disposition family:pr-management pr-management-* skills family:security security-* skills family:setup setup-* skills labels Nov 1, 2026
potiuk added a commit that referenced this pull request Nov 10, 2026
…own instead of an inert fence (#2048)

* feat(security-management): import reports as defanged markdown, not an inert fence

Imported reports (inbound report mails, public PR bodies, findings-file
sections) were wrapped whole in a ```text fence. That kept them inert but
threw away all of the reporter's formatting, which made tracker issues
hard to read.

The new default `markdown_block` keeps the formatting and neutralises
only what could change the tracker or leak:

- `#`-`###` headings (also behind `>` / list markers) are raised to `####`,
  so no line can end or open a template field;
- every HTML opener and `![image](...)` outside code is defused, so no tag,
  comment, `<details>` block or tracking pixel renders;
- bare `#NNN` references and `@`-mentions become inline code, so they
  neither link a wrong tracker issue nor notify anyone;
- code is byte-exact (a `###` / `<!--` line inside a fence gains `\`),
  and a fence the report leaves open is closed before the next field.

The issue-import description sits under a fixed `> [!NOTE]` that marks it
as the reporter's data, keeping the instruction-data separation of threat
model mitigation M.2. `tracker.description_format: inert` (the
`description_format` input of the three render-body commands) restores
the previous fully inert block; the existing inert tests now run in that
mode.

Generated-by: Claude Opus 5

* fix(security-management): close the markdown sanitizer's parser gaps

A review of the defanged-markdown import found ways for report text to
render or hide despite the sanitizer:

- HTML and images inside an inline code span were skipped, and span
  boundaries were guessed line by line. HTML openers and images are now
  defused on the whole line; code spans are matched by exact run length
  and only gate the reference / mention wrapping.
- A fence detected where GitHub sees none (a fence inside a list item or
  block quote, an indented fence GitHub closes earlier) left prose
  unescaped. Only a fence opened at column 0 is kept as code now, since
  CommonMark always reads that as a top-level fence; any other fence-like
  line is broken with a `\`, so its lines are escaped as prose by both
  readers. A closing fence allows only spaces and tabs after it.
- Setext underlines (`===` / `---` under a text line) made headings; their
  first character is escaped.
- Link reference definitions (including the `[//]: # (...)` comment
  idiom) rendered as nothing; their `[` is escaped so they show as text.
- Zero-width and bidi-control characters, code included, become visible
  `[U+XXXX]` tokens.

Generated-by: Claude Opus 5

* fix(security-management): mentions, link definitions and glyphless characters

A second review of the markdown sanitizer found three more gaps:

- A mention or bare reference inside what the line-local code-span match
  took for code could still resolve (a span crossing lines, an escaped
  backtick), and wrapping one in backticks could re-pair the report's own
  backticks. Wrapping as inline code is now kept for lines with no
  backtick and no span possibly left open by an earlier line of the
  paragraph; anywhere else a word joiner follows the `#` / `@`, which no
  reader resolves in code or out of it.
- Link reference definitions inside list items, with escaped brackets in
  the label, or with the label continued on the next line still rendered
  as nothing. The leading `[` is now escaped behind any container markers
  whenever the line holds `]:` or leaves the bracket open.
- Only a fixed set of zero-width and bidi characters was made visible.
  Every format (Cf) character, variation selector and invisible filler
  now becomes a `[U+XXXX]` token, and a character reference has its `&`
  escaped so it cannot decode to one.

A setext underline is also escaped at any indentation, so a nested list
item cannot turn into a heading.

Generated-by: Claude Opus 5

* fix(security-management): keep inline code byte-exact where span boundaries are certain

The word-joiner form for references and mentions applied to every line
with a backtick, so code such as `@task.docker` gained an invisible
U+2060 that breaks copy and paste. When every backtick run on a line
pairs up, none is escaped and no span is left open by an earlier line,
the line-local code spans are the ones CommonMark finds: there the
references and mentions outside them are wrapped as inline code and the
code is left alone. The word joiner is kept for lines whose span
boundaries are uncertain.

Generated-by: Claude Opus 5

* feat(security-management): fence indented code with a language; close review gaps

Mail clients send code as indented lines. GitHub shows those as
unhighlighted code at best, and under a list item as running text, so a
reporter's Python read as prose. A run of lines indented four columns or
more, after a blank line or a line ending in `:`, now becomes a column-0
fence with a guessed language (`python`, `json` only when it parses,
`shell`, else `text`), dedented. A column-0 fence is also the one form of
code whose boundaries the sanitizer and GitHub always agree on.

A further review of the sanitizer found:

- A wrap next to an existing code span could merge backtick runs and
  leave a mention live (``a``@x). The wrapped line is now checked: every
  run must still pair and no reference or mention may sit outside code,
  else the word-joiner form is used.
- `&#123;` shown as text was still read as a reference to issue 123. A
  numeric character reference now gets a word joiner after its `#`, and
  `&` no longer exempts a reference.
- A link-definition label split after an escaped `]` still hid. The
  leading `[` is escaped when the first unescaped `]` is followed by `:`
  or none closes the label on the line.
- A line of non-breaking spaces reset the open-code-span state; only
  spaces and tabs make a blank line, as in CommonMark.

Generated-by: Claude Opus 5

* fix(security-management): decode character references to plain characters

Reports copied from an HTML page carry `&#39;` and `&quot;` for quotes,
which the reference escaping showed literally (`victim &#39;alice&#39;`).
A reference to one ordinary visible character is now decoded to it. One
decoding to markup (`<`, `#`, `@`, backticks and the like) or to a
glyphless character stays escaped as before.

Generated-by: Claude Opus 5

* fix(security-management): decode `&lt;` and `&gt;` references too

Code output copied from HTML (`count &gt; 50,000`, `reset -&gt; DELETED`)
showed the reference literally. Both decode safely: HTML openers are
escaped after decoding, and the final field-boundary check still runs on
a line whose decoded `>` leads.

Generated-by: Claude Opus 5

* fix(security-management): decode character references before the block rules

Decoding ran inside the per-line pass, after the fence, setext, heading
and link-definition checks, so a decoded `>` or space could build block
structure those checks never saw (`&gt; [x]: y` became a hidden
block-quoted link definition). References are now decoded first, so
every rule sees the characters GitHub will parse and decoded text is
sanitised exactly like typed text. Only `&`, glyphless and non-printable
characters (line breaks included) are never decoded.

Generated-by: Claude Opus 5

* fix(security-management): defuse math, alert markers and GH- references

A review of the pushed sanitizer found three more renderings a report
could use:

- GitHub renders `$` math, where `\color` / `\phantom` can hide text, and
  draws `math`, `mermaid`, `geojson`, `topojson`, `stl` and `plantuml`
  fences instead of showing them as code. Every `$` in prose is now
  backslash-escaped (code keeps its `$`), and such a fence opens as
  `text`.
- A `> [!IMPORTANT]` line in a report rendered as a GitHub alert, just
  like the tool's own `[!NOTE]`. The `[` of an alert marker in a block
  quote is escaped.
- `GH-123` (any case) links an issue like `#123` does; it is wrapped as
  inline code, or broken with a word joiner where code-span boundaries
  are uncertain.

Generated-by: Claude Opus 5

* fix(security-management): normalise fence languages and backslash runs before `$`

- A rendered-fence language could be spelled past the check with a
  backslash escape, a character reference or a tab (`ma\th`, `&#109;ath`,
  `math<TAB>x`). The info string is now split on spaces and tabs, and a
  first word that is not a plain name ([A-Za-z0-9_+#.-]) opens as `text`
  too.
- A `$` after `\\` was left alone although the two backslashes escape
  each other and the `$` stays live. A `$` is now treated as escaped only
  after an odd run of backslashes.

Generated-by: Claude Opus 5

* fix(security-management): remove exponential backtracking in the container-heading regex

The container prefix repeated `[ \t]*<marker>[ \t]*`, so the whitespace
between two markers could belong to either repetition. A line such as
`>\t>\t>...x` that ends without a heading then backtracked exponentially
(CodeQL py/redos). Whitespace is now matched only before each marker; the
set of matched lines is unchanged.

Generated-by: Claude Opus 5

* chore(rat): exclude the reconciled-stamp skill list

tools/dev/reconciled-stamp-excluded.txt (added in #2047) is a plain data
list read by refresh-reconciled-stamp.py and carries no licence header, so
the rat check failed on every PR. List it in .rat-excludes.

Generated-by: Claude Opus 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:fix Implement code change to resolve an issue capability:intake Import external signal + sync tracker state capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) capability:resolve Close-out: invalidate, dedupe, CVE allocate, announcement capability:review Deep per-item code review or contributor mentoring capability:stats Read-only dashboards, metrics, governance evidence capability:triage Sweep + classify + propose disposition family:pr-management pr-management-* skills family:security security-* skills family:setup setup-* skills mode:platform Substrate / infra — not a mode (sandbox, CI, validators)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants