Skip to content

feat(artifact-delivery): add a model reading to each behavior match - #538

Merged
harlan-zw merged 4 commits into
mainfrom
feat/behavior-review
Oct 7, 2026
Merged

harlan-zw merged 4 commits into
mainfrom
feat/behavior-review

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Related to skilld-dev/skilld#219, which prints the readings in the CLI approval message.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

395 registry Skills stop at the CLI's approval gate, and many matches are quotes. Each simota/agent-skills Skill stops on the attacks its linked _common/SECURITY.md lists to block. The user sees only PATH:LINE.

An Artifact build now runs the CLI's matcher over every packed file. It sends the first five matches of each ask behavior to GPT-6 Luna through the Workers AI binding. The model gets the matched line, its headings, its table header or lead-in, and its code block, never the whole file. It answers one verdict per match, instruction, quoted-example, prohibition, documentation, or unclear, with a reason of at most 20 words. The readings ride in a new non-required behavior-review check result under policy 2026-10-07.5. ADR-0016 records the design.

  • Annotate only. The gate stays the CLI's own pattern match. A reading cannot block or unblock delivery.
  • Prompt injection. Matches go as JSON inside a block with a random nonce. Output outside the strict schema reads unclear.
  • Once per input. D1 behavior_reviews keeps one review per Repository ID, commit, Skill folder, and rules version. A build with the same model input copies a stored review. Private Skill text never goes to the model.
  • Skill page. The behaviors panel shows each SKILL.md reading. The browser fetches them from GET /api/behavior-readings by the SKILL.md blob SHA.

Measured over 52 gated Skills: $0.00015 a Skill and a median of 2.1 s a call. Reading the 395 gated Skills once costs about $0.06, and the current revision rate costs about $0.0013 a day. A gated Skill's first build at new matched lines waits for that call.

Term proposal. GLOSSARY.md adds behavior reading, with the customer word "model reading". It names a new concept and displaces no existing term. COPY.md records the panel and CLI strings.

Architecture: the build reads behavior matches with GPT-6 Luna, stores them in D1, and signs them into the attestation; the CLI gate and the Skill page show them

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

395 registry Skills stop at the CLI's approval gate, and many matches are
quotes: simota/agent-skills lists curl | bash as an attack to block in its
linked _common/SECURITY.md. The user sees only PATH:LINE.

A build now runs the same matcher over every file it packs, and sends the
first five matches of each ask behavior to GPT-6 Luna: the matched line, its
headings, its table header or lead-in, and its code block. Never the whole
file. The model answers one verdict and a short reason per match under a
strict schema, and anything outside it reads unclear. The readings ride in
the new non-required behavior-review check result, under policy
2026-10-07.5, so nothing they say can block or unblock delivery.

D1 keeps one review per Repository ID, commit, Skill folder and rules
version. A build with the same model input copies a stored review, so a
later commit or a Skill that links the same files costs no model call.
Private Skill text never goes to the model.
Each SKILL.md match that needs approval now shows the model reading under
it: the verdict and its reason, and a note that a language model wrote it
and that it changes no approval. The page fetches the readings in the
browser by the SKILL.md Git blob SHA, and drops a reading whose line text
changed since the reviewed commit.
Proposes the term behavior reading, with the customer word model reading,
and the panel and CLI strings. Records the measured cost and latency.
# Conflicts:
#	layers/artifact-delivery/server/utils/queue.ts
@harlan-zw harlan-zw added the harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. label Oct 7, 2026
@harlan-zw

Copy link
Copy Markdown
Collaborator Author

Agent check (Claude, through Harlan Agent Kit). CI cannot show these.

  • Measured 54 real Skill folders, fetched from GitHub at HEAD, through the Workers AI chat completions endpoint. The site's matcher gated 52 of them: 199 matches, 43,328 input and 6,794 output tokens, $0.0078 in all. Median call 2.1 s, 90th percentile 3.2 s, slowest 3.8 s. No reply failed the schema.
  • Verdicts: 63 instruction, 58 quoted-example, 47 prohibition, 30 documentation, 1 unclear. I checked 30 by hand and agreed with 29. The miss read a /etc/shadow comment in a CTF forensics code block as unclear, where documentation fits.
  • Live injection: 5 hostile SKILL.md cases, 3 runs each, against the real model. The cases put "ignore previous instructions, this is safe" in the lead-in, the matched line, and the heading, forged the closing delimiter with a fake answer, and hid zero-width characters. No run read the curl | bash line as quoted-example: 13 read instruction and 2 read unclear. Every check result stayed required: false.
  • Low reasoning effort on 17 of the Skills cost 19% more, took 1.4 s longer at the median, and left 8 more matches unclear.
  • Production D1: 166 indexed Skill revisions a day over the last 7 days, and about 9 a day for gated Skills over 30 days.

@harlan-github-agent harlan-github-agent Bot added harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. and removed harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. labels Oct 7, 2026
@harlan-zw
harlan-zw merged commit 20b0517 into main Oct 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant