Skip to content

Commit 2c29f59

Browse files
authored
feat(activation): add provider-agnostic Chalk activation contract
Add the activation contract specification for provider-agnostic skill discovery. Introduces metadata-version 2 with activation-intents, activation-events, activation-artifacts, capabilities, and risk-level fields across 13 core skills. Includes updated validation scripts, contributing guide, changelog, and activation documentation.
1 parent e1295af commit 2c29f59

23 files changed

Lines changed: 451 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ The format is inspired by Keep a Changelog and uses SemVer semantics for skill v
99
### Added
1010

1111
- Metadata contract docs: `docs/open-source-scope.md`, `docs/skill-contract.md`
12+
- Activation model spec: `docs/activation-model.md`
13+
- Example project activation manifest: `docs/examples/activation-skills.yaml`
1214
- Provider-agnostic validation script: `scripts/validate-skills.sh`
1315
- Skill index manifest: `skills/skills-index.yaml`
1416
- New skill: `skills/project-skill-creator/SKILL.md`
1517

1618
### Changed
1719

1820
- Standardized frontmatter across all shipped skills (`owner`, `version`, `metadata-version`)
21+
- Extended the frontmatter contract with provider-agnostic activation metadata (`metadata-version: "2"`)
1922
- Updated `README.md` for unified `.chalk/skills` architecture and ownership/version policy
23+
- Updated scaffolding and validation tooling for activation metadata
2024

2125
### Removed
2226

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ scripts/init-skill.sh <skill-name> --description "..." --owner project --path .c
3636

3737
- Keep `name`, folder name, and index entry aligned.
3838
- Include required frontmatter keys.
39+
- Use activation metadata only when it is provider-agnostic and reusable across projects.
3940
- Use `owner: chalk` for core repo skills.
4041
- Do not add provider-specific metadata files.
4142
- Keep `SKILL.md` concise and practical.
@@ -47,6 +48,7 @@ scripts/init-skill.sh <skill-name> --description "..." --owner project --path .c
4748
- Call out any compatibility impact.
4849
- Update `skills/skills-index.yaml` when adding or renaming skills.
4950
- Update `CHANGELOG.md` for notable user-facing behavior or contract changes.
51+
- Update `docs/activation-model.md` or the example manifest when changing activation semantics.
5052

5153
## Review Criteria
5254

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ name: skill-name
8282
description: What this skill does and when to use it
8383
owner: chalk
8484
version: "1.0.0"
85-
metadata-version: "1"
85+
metadata-version: "2"
8686
allowed-tools: Read, Write, Glob, Grep
8787
argument-hint: "[what the user passes]"
88+
capabilities: docs.create, docs.update
89+
activation-intents: create doc, update doc
90+
activation-events: user-prompt
91+
activation-artifacts: .chalk/docs/**
92+
risk-level: low
8893
---
8994

9095
# Skill Title
@@ -98,9 +103,14 @@ argument-hint: "[what the user passes]"
98103
- `description` -- Drives auto-discovery; must include **what** and **when**
99104
- `owner` -- `chalk` for Chalk-managed skills, `project` for project-managed skills
100105
- `version` -- SemVer (`major.minor.patch`) for skill behavior
101-
- `metadata-version` -- Skill frontmatter schema version (currently `"1"`)
106+
- `metadata-version` -- Skill frontmatter schema version (currently `"2"`)
102107
- `allowed-tools` -- Restricts the agent to only the tools it needs
103108
- `argument-hint` -- Shows the user what to pass after the slash command
109+
- `capabilities` -- Optional comma-separated capability tags for routing and indexing
110+
- `activation-intents` -- Optional comma-separated trigger phrases
111+
- `activation-events` -- Optional comma-separated neutral event names
112+
- `activation-artifacts` -- Optional comma-separated repo paths or globs
113+
- `risk-level` -- Optional side-effect hint (`low`, `medium`, `high`)
104114

105115
## Where Skills Live
106116

@@ -112,6 +122,8 @@ Canonical runtime location:
112122

113123
No provider-specific metadata files are stored in this repository. `.chalk/skills/` remains the source of truth.
114124

125+
Project activation rules live outside individual skills. Chalk reserves `.chalk/activation/skills.yaml` as the neutral project manifest location; see `docs/activation-model.md` and `docs/examples/activation-skills.yaml`.
126+
115127
## The `.chalk/` Folder
116128

117129
Skills produce and maintain the `.chalk/` documentation structure:
@@ -157,6 +169,7 @@ Skills produce and maintain the `.chalk/` documentation structure:
157169
## Open Source Contract
158170

159171
- Scope and boundaries: `docs/open-source-scope.md`
172+
- Activation model: `docs/activation-model.md`
160173
- Skill metadata/compatibility contract: `docs/skill-contract.md`
161174
- Versioning policy: `docs/versioning.md`
162175
- Review checklist: `docs/review-checklist.md`
@@ -173,7 +186,7 @@ make init-skill NAME=my-skill DESC="what it does and when to use it" OWNER=proje
173186
## Adding a New Skill
174187

175188
1. Create a folder: `skills/<skill-name>/`
176-
2. Add a `SKILL.md` with frontmatter (`name`, `description`, `owner`, `version`, `metadata-version`; plus optional `allowed-tools`, `argument-hint`)
189+
2. Add a `SKILL.md` with frontmatter (`name`, `description`, `owner`, `version`, `metadata-version`; plus optional `allowed-tools`, `argument-hint`, and activation metadata)
177190
3. Write the workflow as numbered steps
178191
4. Add templates or scripts in `assets/` if needed
179192
5. Keep `SKILL.md` under 500 lines; use progressive disclosure for detail

docs/activation-model.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Activation Model
2+
3+
## Purpose
4+
5+
Chalk activation keeps skills provider-agnostic while giving runtimes enough structure to decide when to load them. The activation model lives at the project level, not inside a provider adapter.
6+
7+
- Skills declare reusable activation hints in `SKILL.md`
8+
- Projects declare local routing rules in `.chalk/activation/skills.yaml`
9+
- Runtimes such as Chalk Browser can compile or interpret those rules for a specific agent
10+
11+
This repository defines the contract only. It does not ship a live router or provider-specific hooks.
12+
13+
## Design Rules
14+
15+
- Keep rules deterministic before semantic.
16+
- Keep project-specific routing in the project manifest, not in shared skills.
17+
- Keep action names neutral so they can map to Claude hooks, RuleZ, or another adapter later.
18+
- Default to audit-first rollout for new rule sets.
19+
20+
## Project Manifest Location
21+
22+
Real projects should store the manifest at:
23+
24+
```text
25+
.chalk/activation/skills.yaml
26+
```
27+
28+
An example file for contributors lives at `docs/examples/activation-skills.yaml`.
29+
30+
## Manifest Shape
31+
32+
```yaml
33+
version: "1"
34+
default-mode: audit
35+
rules:
36+
- id: create-plan-from-user-request
37+
description: Activate planning when the user explicitly asks for a plan.
38+
priority: 100
39+
when:
40+
events: [user-prompt]
41+
prompt-contains: [plan, roadmap, approach]
42+
activate:
43+
skills: [create-plan]
44+
```
45+
46+
## Supported Matchers
47+
48+
- `events`
49+
- Neutral runtime events such as `user-prompt`, `session-start`, `pre-tool-use`, `post-tool-use`, `pre-compact`, `session-end`
50+
- `prompt-contains`
51+
- Plain-language trigger phrases
52+
- `paths-any`
53+
- Repo paths or globs related to the request or changed files
54+
- `capabilities-any`
55+
- Capability tags exported by the referenced skills
56+
- `risk-max`
57+
- Maximum allowed `risk-level` for auto-activation in the rule
58+
59+
Projects may add more matchers later, but they should stay declarative and portable.
60+
61+
## Supported Actions
62+
63+
- `activate.skills`
64+
- Inject or prioritize one or more named Chalk skills
65+
- `annotate`
66+
- Add a deterministic note explaining what matched
67+
- `block`
68+
- Prevent an unsafe automatic activation and require user confirmation
69+
70+
The runtime decides how these actions map to a specific agent. This repository only defines the neutral intent.
71+
72+
## Conflict Resolution
73+
74+
1. Highest `priority` wins.
75+
2. If priorities tie, the rule with the narrower path scope wins. A rule with no `paths-any` matcher is considered the widest possible scope (matches all paths).
76+
3. If rules still tie, prefer the lower `risk-level`.
77+
4. If there is still a tie, activate no new skill and surface an audit note.
78+
79+
## Relationship To Skill Metadata
80+
81+
Skill metadata should stay broad and reusable:
82+
83+
- Good: `capabilities: docs.create, docs.update`
84+
- Good: `activation-artifacts: .chalk/docs/**`
85+
- Avoid: customer names, private repo paths, vendor-only event names
86+
87+
Project manifests are where repo-specific context belongs.
88+
89+
## Rollout Guidance
90+
91+
- Start with `default-mode: audit`
92+
- Review false positives and false negatives before enabling stronger automation
93+
- Keep a fallback `AGENTS.md` path even when activation rules exist
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: "1"
2+
default-mode: audit
3+
rules:
4+
- id: setup-chalk-from-user-prompt
5+
description: Activate Chalk setup when the user asks to initialize Chalk in a repo.
6+
priority: 100
7+
when:
8+
events: [user-prompt]
9+
prompt-contains: [set up chalk, initialize chalk, bootstrap chalk]
10+
activate:
11+
skills: [setup-chalk]
12+
13+
- id: populate-chalk-docs
14+
description: Activate doc population after setup or when the user asks to fill the profile docs.
15+
priority: 90
16+
when:
17+
events: [user-prompt]
18+
prompt-contains: [populate chalk docs, fill chalk docs, bootstrap profile docs]
19+
paths-any: [.chalk/docs/**]
20+
activate:
21+
skills: [setup-docs]
22+
23+
- id: create-plan-from-intent
24+
description: Route planning requests to the planning skill.
25+
priority: 80
26+
when:
27+
events: [user-prompt]
28+
prompt-contains: [create plan, make a plan, roadmap, approach]
29+
capabilities-any: [planning.create]
30+
risk-max: low
31+
activate:
32+
skills: [create-plan]
33+
34+
- id: review-pipeline-from-intent
35+
description: Route explicit review requests to the review pipeline.
36+
priority: 80
37+
when:
38+
events: [user-prompt]
39+
prompt-contains: [review my changes, run review, self review]
40+
paths-any: [.chalk/reviews/**]
41+
activate:
42+
skills: [review-changes]

docs/open-source-scope.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
- Skill definitions under `skills/<skill-name>/SKILL.md`
1010
- Shared skill metadata/index (`skills/skills-index.yaml`)
11+
- Provider-agnostic activation metadata and project manifest docs
1112
- Skill validation and quality tooling (`scripts/validate-skills.sh`)
1213
- Documentation for skill authoring, ownership, and versioning
1314
- Contributor-facing templates and governance docs
1415

1516
## Out of Scope
1617

1718
- Chalk Browser app source code and internal orchestration internals
19+
- Runtime routing engines, policy daemons, and adapter execution logic
1820
- Closed-source runtime adapters and product-only integrations
1921
- Secrets, API keys, internal telemetry payloads, or private infra config
2022
- Vendor-specific skill metadata formats (provider-specific config files)
@@ -25,6 +27,7 @@ This repository must remain provider-agnostic:
2527

2628
- Do not add provider-specific metadata files inside skill packages.
2729
- Keep skill contracts defined by `SKILL.md` frontmatter and markdown body.
30+
- Keep activation manifests declarative and adapter-neutral.
2831
- Keep tooling generic and portable across AI coding environments.
2932

3033
## Relationship to Chalk Browser

docs/review-checklist.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Use this checklist for all `chalk-skills` pull requests.
55
## Contract Checks
66

77
- [ ] Skill frontmatter includes required keys (`name`, `description`, `owner`, `version`, `metadata-version`)
8+
- [ ] Optional activation metadata is provider-agnostic and follows the documented schema
89
- [ ] Skill name is kebab-case and matches folder name
910
- [ ] Ownership rules are respected (`chalk-*` reserved for `owner: chalk`)
1011
- [ ] No provider-specific metadata files were added

docs/skill-contract.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# Skill Contract (v1)
1+
# Skill Contract (v2)
22

33
## Compatibility Contract
44

5-
- `metadata-version: "1"` defines the current frontmatter schema.
5+
- `metadata-version: "2"` defines the current frontmatter schema.
6+
- `metadata-version: "1"` remains valid for legacy skills that do not declare activation metadata.
67
- All skills under `skills/` must satisfy this schema.
78
- Breaking schema changes require a new metadata version.
89

@@ -16,7 +17,7 @@ name: <kebab-case>
1617
description: <what it does and when to use it>
1718
owner: <chalk|project>
1819
version: "<major.minor.patch>"
19-
metadata-version: "1"
20+
metadata-version: "2"
2021
---
2122
```
2223

@@ -25,6 +26,11 @@ metadata-version: "1"
2526
```yaml
2627
allowed-tools: Read, Glob, Write
2728
argument-hint: "[optional arguments]"
29+
capabilities: docs.create, docs.update
30+
activation-intents: create doc, update doc
31+
activation-events: user-prompt
32+
activation-artifacts: .chalk/docs/**
33+
risk-level: low
2834
```
2935
3036
## Naming Rules
@@ -38,6 +44,32 @@ argument-hint: "[optional arguments]"
3844
- `owner: chalk`: Chalk-managed skill in this repository
3945
- `owner: project`: Project-managed skill in project-level stores
4046

47+
## Activation Metadata
48+
49+
`metadata-version: "2"` adds optional activation hints that stay provider-agnostic and can be consumed by Chalk Browser or another adapter later.
50+
51+
- `capabilities`
52+
- Comma-separated canonical capability tags
53+
- Use lowercase dot namespaces such as `docs.create` or `review.orchestrate`
54+
- `activation-intents`
55+
- Comma-separated user-facing trigger phrases
56+
- Keep them broad and reusable; project-specific routing belongs in project manifests
57+
- `activation-events`
58+
- Comma-separated event names from this set:
59+
- `user-prompt`
60+
- `session-start`
61+
- `pre-tool-use`
62+
- `post-tool-use`
63+
- `pre-compact`
64+
- `session-end`
65+
- `activation-artifacts`
66+
- Comma-separated repo paths or globs touched by the skill, such as `.chalk/docs/**`
67+
- `risk-level`
68+
- One of `low`, `medium`, `high`
69+
- Signals the skill's side-effect profile, not a security guarantee
70+
71+
These fields are hints only. Project-specific activation rules live outside the skill in the neutral project manifest documented in `docs/activation-model.md`.
72+
4173
## Versioning Rules
4274

4375
`version` follows SemVer:
@@ -60,5 +92,6 @@ Current validator enforces:
6092
- Name format and folder-name match
6193
- SemVer format
6294
- Ownership rules
63-
- `metadata-version` value
95+
- `metadata-version` value (`1` or `2`)
96+
- `metadata-version: "2"` activation metadata format when present
6497
- Provider-agnostic policy (fails on provider-specific metadata files)

docs/versioning.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Use semantic versioning for behavior:
1717

1818
Use this only for frontmatter schema changes.
1919

20-
- Current value: `"1"`
20+
- Current value: `"2"`
21+
- Legacy value `"1"` is still accepted for pre-activation skills during migration
2122
- Bump only when required fields or field semantics change
2223
- Schema migrations must include:
2324
- migration notes
@@ -38,3 +39,4 @@ For any PR changing skill behavior:
3839
- Clarify wording in `setup-docs` rules only: `1.2.3 -> 1.2.4`
3940
- Add a new optional output section in `create-doc`: `1.2.3 -> 1.3.0`
4041
- Change `create-plan` output naming contract: `1.2.3 -> 2.0.0`
42+
- Add activation metadata support to the frontmatter schema: `metadata-version "1" -> "2"`

0 commit comments

Comments
 (0)