Skip to content

Commit 06993c5

Browse files
Gkrumbach07Ambient Code Bot
andauthored
spec: skills and workflows — discovery, installation, and usage (#1117)
## Summary Defines the architecture for how skills, workflows, and agents work in ACP. **Core insight**: A workflow is just a prompt + a list of skill source references. Skills are the atomic reusable unit. The manifest format is the contract — ACP and local tooling are just consumers. ## Key Decisions - **Workflows don't contain skills** — they reference them by Git URL + path - **Skills are always fetched from canonical sources** at load time, not embedded copies - **Workspace library != auto-inject** — installing to workspace makes items available, not active. Users select what loads per session. - **Same manifest works everywhere** — ACP runner, local `--add-dir`, a `/load-workflow` meta-skill, or a Claude Code plugin - **Layered loading** — workflow dependencies + user-selected extras + live imports, all fed into `add_dirs` ## Sections 1. **Core Concepts** — Skill, Workflow, Agent, Manifest Format 2. **Discovery** — Marketplace, scanning, catalog format 3. **Installation & Configuration** — Workspace level, session level, workflow builder, selection model 4. **Usage in Sessions** — Loading order, runtime management, metadata 5. **Local Usage** — Manual, load-workflow skill, Claude Code plugin 6. **Manifest Format** — Proposed YAML schema 7. **Open Questions** — Format, versioning, plugin compat, RHAI alignment, security ## For Review Looking for feedback on: - The manifest format (extend ambient.json vs new workflow.yaml?) - The selection model (workspace library vs auto-inject) - The Agent concept (persona + workflows + skills) - RHAI alignment (RHAIRFE-1370) --------- Co-authored-by: Ambient Code Bot <bot@ambient-code.local>
1 parent 77ace72 commit 06993c5

1 file changed

Lines changed: 269 additions & 0 deletions

File tree

specs/skills-and-workflows.md

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# Skills & Workflows: Discovery, Installation, and Usage
2+
3+
## Summary
4+
5+
A workflow is a `CLAUDE.md` prompt plus a list of sources in `ambient.json`. Skills are the atomic reusable unit. ACP automates the cloning and wiring. Locally, a `/load-workflow` skill or manual `--add-dir` does the same thing.
6+
7+
---
8+
9+
## Core Concepts
10+
11+
### Skill
12+
13+
The atomic unit of reusable capability. A directory containing a `SKILL.md` file with YAML frontmatter and markdown instructions. Claude Code discovers skills from `.claude/skills/{name}/SKILL.md` in the working directory, parent directories, `--add-dir` directories, and plugins.
14+
15+
Skills have live change detection in `--add-dir` directories — place a new skill file and Claude discovers it immediately without restarting. Skills are invoked via `/skill-name` or auto-triggered by Claude based on the description in frontmatter.
16+
17+
Commands (`.claude/commands/{name}.md`) and agents (`.claude/agents/{name}.md`) follow the same discovery pattern and are treated as peers to skills throughout this spec. "Skill" is used as shorthand for all three unless distinction matters.
18+
19+
### Workflow
20+
21+
A workflow is two things:
22+
23+
1. **A prompt** — the directive and methodology, written as `CLAUDE.md` in the workflow directory. This is the only prompt mechanism — no separate `systemPrompt` or `startupPrompt` fields.
24+
2. **A list of sources** — references in `ambient.json` to skills, commands, agents, and plugins from various Git repos. Not embedded copies — references resolved at load time.
25+
26+
A workflow does not contain skills. It references them. The bug-fix workflow becomes:
27+
28+
**`CLAUDE.md`**:
29+
```markdown
30+
You are a systematic bug fixer. Follow these phases:
31+
1. Use /assess to understand the issue
32+
2. Use /reproduce to create a failing test
33+
3. Use /diagnose to find the root cause
34+
4. Use /fix to implement the minimal fix
35+
5. Use /test to verify the fix
36+
6. Use /review to self-review before PR
37+
```
38+
39+
**`ambient.json`**:
40+
```json
41+
{
42+
"name": "Bug Fix",
43+
"description": "Systematic bug resolution with phased approach",
44+
"sources": [
45+
{"url": "https://github.com/ambient-code/skills.git", "branch": "main", "path": "bugfix/assess"},
46+
{"url": "https://github.com/ambient-code/skills.git", "path": "bugfix/reproduce"},
47+
{"url": "https://github.com/ambient-code/skills.git", "path": "bugfix/diagnose"},
48+
{"url": "https://github.com/ambient-code/skills.git", "path": "bugfix/fix"},
49+
{"url": "https://github.com/ambient-code/skills.git", "path": "bugfix/test"},
50+
{"url": "https://github.com/ambient-code/skills.git", "path": "bugfix/review"},
51+
{"url": "https://github.com/opendatahub-io/ai-helpers.git", "path": "helpers/skills/jira-activity"},
52+
"https://github.com/my-org/shared-skills/tree/main/code-review"
53+
],
54+
"rubric": {
55+
"activationPrompt": "After completing the fix, evaluate your work",
56+
"criteria": [
57+
{"name": "Root cause identified", "weight": 0.3},
58+
{"name": "Tests added", "weight": 0.3},
59+
{"name": "Minimal change", "weight": 0.2},
60+
{"name": "No regressions", "weight": 0.2}
61+
]
62+
}
63+
}
64+
```
65+
66+
Sources support two formats:
67+
- **Structured object**: `{"url": "...", "branch": "...", "path": "..."}` — works with any Git host, branch is explicit
68+
- **Single URL string**: `"https://github.com/org/repo/tree/main/path"` — auto-parsed, convenient for sharing
69+
70+
Skills are the reusable atoms. Workflows are recipes. The same skill can appear in multiple workflows.
71+
72+
### Agent (future)
73+
74+
A persona — prose defining what an agent is responsible for. "Backend Agent", "Security Agent", "PM Agent". An Agent uses workflows and standalone skills to accomplish its goals. An Agent is a session template with a personality:
75+
76+
```
77+
Agent = Persona (CLAUDE.md) + Workflows (skill bundles) + Standalone skills
78+
```
79+
80+
A "Bug Fix Agent" = bug-fix persona + bug-fix workflow skills + any additional skills. Same skills reusable by different Agents with different motivations.
81+
82+
Multi-agent orchestration (research agent → writer agent → editor agent pipelines) is a separate design problem out of scope for this spec.
83+
84+
---
85+
86+
## Discovery
87+
88+
### What
89+
90+
A way to browse and find skills, workflows, and plugins from curated sources.
91+
92+
### Source Types
93+
94+
The scanner must support three types of sources:
95+
96+
1. **Claude Code plugins** — directories with `.claude-plugin/plugin.json` containing `skills/`, `commands/`, `agents/`, `hooks/`, `.mcp.json`. This is the primary format to follow and expect. Skills are namespaced as `plugin-name:skill-name`.
97+
98+
2. **Claude Code marketplace catalogs**`marketplace.json` files listing plugins with their sources. Users could add the same marketplace from local Claude Code via `/plugin marketplace add`.
99+
100+
3. **Standalone repos with `.claude/`** — any Git repo containing `.claude/skills/`, `.claude/commands/`, `.claude/agents/`. Also supports root-level `skills/`, `commands/`, `agents/` (registry layout like ai-helpers).
101+
102+
### How
103+
104+
A cluster-level ConfigMap (`marketplace-sources`) holds available registry sources. The Marketplace page in the ACP UI shows:
105+
106+
- Browsable catalogs from each source with search and type filters
107+
- Compact card tiles with name, description, type badge
108+
- Detail panel on click with full description, source repo link
109+
- "Import Custom" to scan any Git URL and discover items
110+
- Direct one-click install to workspace
111+
112+
### Scanning
113+
114+
When given a Git URL (from marketplace or custom), the backend:
115+
116+
1. Shallow clones the repo
117+
2. Applies optional path filter (subdirectory)
118+
3. Checks for `.claude-plugin/plugin.json` (Claude Code plugin format)
119+
4. Scans for items in both patterns:
120+
- `.claude/skills/*/SKILL.md`, `.claude/commands/*.md`, `.claude/agents/*.md`
121+
- `skills/*/SKILL.md`, `commands/*.md`, `agents/*.md` (registry layout)
122+
5. Checks for `.ambient/ambient.json` (indicates this is a workflow)
123+
6. Checks for `CLAUDE.md` (indicates project instructions)
124+
7. Returns discovered items with frontmatter metadata
125+
126+
### Format Alignment
127+
128+
We follow Claude Code's plugin and skill formats as the standard. The [Agent Skills](https://agentskills.io) open standard that Claude Code implements is the closest cross-tool specification. Our catalog format normalizes to the same shape regardless of source type.
129+
130+
---
131+
132+
## Installation & Configuration
133+
134+
### Workspace Level
135+
136+
Items installed at the workspace level are stored in the ProjectSettings CR (`spec.installedItems`). These represent the workspace's **library** — what's available, not what's auto-loaded into every session.
137+
138+
When creating a session, users select which installed items to include. The workflow they choose pulls in its own skill dependencies from the `sources` array in `ambient.json`.
139+
140+
### Session Level
141+
142+
Skills can be added to a running session via the context panel:
143+
144+
- "Import Skills" in the Add Context dropdown
145+
- Provide a Git URL + optional branch + path
146+
- Backend clones, scans, writes skill files to `/workspace/file-uploads/.claude/`
147+
- Claude discovers them via live change detection (already in `add_dirs`)
148+
- Persisted via S3 state-sync on session suspend/resume
149+
150+
### Workflow Builder
151+
152+
A UI for composing workflows from standalone skills:
153+
154+
- Select skills from the workspace library or browse marketplace
155+
- Each skill is a reference (source URL + path), not a copy
156+
- Write the workflow prompt as `CLAUDE.md`
157+
- Configure metadata in `ambient.json` (name, description, rubric)
158+
- The `sources` array is built from selected skills
159+
- Save as a workflow that can be:
160+
- Stored in the workspace
161+
- Exported as a Git repo
162+
- Exported as a Claude Code plugin
163+
164+
The key constraint: skills are never copied into the workflow. The `ambient.json` holds source references. At load time, the runner resolves dependencies and clones each source.
165+
166+
### How Selection Works
167+
168+
The workspace library is not auto-injected. Selection happens at session creation:
169+
170+
1. User picks a workflow (or "General chat" for none)
171+
2. The workflow's `ambient.json` `sources` array declares dependencies — those are auto-loaded
172+
3. User can optionally add standalone skills from the workspace library
173+
4. The session CRD stores the workflow reference + any additional skill sources
174+
175+
This means:
176+
- Installing 50 skills to the workspace doesn't bloat every session
177+
- The workflow controls its own dependencies
178+
- Users can augment with extras per session
179+
- Workspace-level "always-on" skills could be supported via a flag but are not the default
180+
181+
---
182+
183+
## Usage in Sessions
184+
185+
### Loading
186+
187+
When a session starts, sources are loaded in layers:
188+
189+
1. **Workflow sources** — skills from the workflow's `ambient.json` `sources` array, cloned and added to `add_dirs`
190+
2. **Additional standalone sources** — extra skills the user selected at session creation
191+
3. **Live additions** — skills imported during the session via the context panel
192+
193+
All layers produce directories with `.claude/skills/`, `.claude/commands/`, `.claude/agents/` structure. Each directory is passed to the Claude Agent SDK as an `--add-dir`. Claude Code handles discovery from there.
194+
195+
The `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` env var is set so that `CLAUDE.md` files from add-dirs are also loaded.
196+
197+
### Authentication for Sources
198+
199+
Private repos and authenticated services (MCP servers) use the existing workspace credential system. If the workspace has GitHub/GitLab integrations configured, private source repos are cloned using those credentials via the git credential helper. MCP sources that require auth and TLS are handled through workspace integration configuration. No new auth fields in the manifest.
200+
201+
### Runtime Management
202+
203+
The session context panel shows:
204+
205+
- **Repositories** — Git repos cloned as working directories (existing)
206+
- **Skills** — imported skills/commands/agents with type badges and source links
207+
- **Uploads** — uploaded files (existing)
208+
209+
Users can add skill sources live (Import Skills button). The backend clones the source, writes files to `/workspace/file-uploads/.claude/`, and Claude picks them up immediately. Users can remove individual skills — the file is deleted and Claude stops seeing it.
210+
211+
### Workflow Metadata
212+
213+
The runner's `/content/workflow-metadata` endpoint returns all discovered skills, commands, and agents from:
214+
- The active workflow's `.claude/` directory
215+
- Any additional source directories
216+
- `/workspace/file-uploads/.claude/` (live imports)
217+
- Built-in Claude Code skills (batch, simplify, debug, claude-api, loop)
218+
219+
The frontend uses this to populate the Skills toolbar button and `/` autocomplete in the chat input.
220+
221+
---
222+
223+
## Local Usage (outside ACP)
224+
225+
### 1. Manual
226+
227+
```bash
228+
git clone --depth 1 https://github.com/ambient-code/skills.git /tmp/skills
229+
git clone --depth 1 https://github.com/opendatahub-io/ai-helpers.git /tmp/ai-helpers
230+
231+
claude \
232+
--add-dir /tmp/skills/bugfix \
233+
--add-dir /tmp/ai-helpers/helpers
234+
```
235+
236+
### 2. Load-workflow skill
237+
238+
A meta-skill that reads a workflow's `ambient.json`, clones each source, and passes them as `--add-dir`:
239+
240+
```
241+
~/.claude/skills/load-workflow/SKILL.md
242+
```
243+
244+
Usage:
245+
```
246+
/load-workflow https://github.com/ambient-code/workflows/tree/main/workflows/bugfix
247+
```
248+
249+
The skill instructs Claude to:
250+
1. Fetch the workflow's `ambient.json`
251+
2. Clone each source to temp directories
252+
3. Symlink `.claude/` structures into the project
253+
4. The workflow's `CLAUDE.md` is loaded automatically
254+
255+
This makes ACP workflows portable — anyone with Claude Code can use them without ACP.
256+
257+
---
258+
259+
## Open Questions
260+
261+
1. **Skill versioning**: Sources reference branches today. Should we support tags or SHAs for pinning? What happens when a skill source updates — do sessions get the latest on next start?
262+
263+
2. **Plugin format**: Should workflow export produce a Claude Code plugin (`plugin.json`)? Pros: portable, namespaced, versioned. Cons: plugins cache/copy files which breaks the dynamic reference model.
264+
265+
3. **RHAI alignment**: How does this map to RHAIRFE-1370 (Skills Registry)? Our `sources` format and marketplace could inform the product's in-cluster registry design.
266+
267+
4. **Security**: How do we verify skill sources haven't been tampered with? Git commit SHAs provide content-addressable verification. Enterprise customers may need signed manifests.
268+
269+
5. **Workspace defaults**: Should some workspace-level items be "always-on" (loaded in every session regardless of workflow)? Or should this be handled via org-level Claude Code managed settings?

0 commit comments

Comments
 (0)