Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(skills): read a SKILL.md written for another agent
Harald6f613d548504
diff --git a/docs/marketplace/community-registry.md b/docs/marketplace/community-registry.mdindex 81460b39df..47ec8de540 100644--- a/docs/marketplace/community-registry.md+++ b/docs/marketplace/community-registry.md@@ -2,7 +2,8 @@**Status:** live since 2026-08-12 ·**Decisions:** [public-marketplace-analysis.md](public-marketplace-analysis.md) ·-**Packaging:** [agent-plugins-standard.md](agent-plugins-standard.md)+**Packaging:** [agent-plugins-standard.md](agent-plugins-standard.md) ·+**Skills for other agents:** [portable-skills.md](portable-skills.md)Anyone can publish plugins and skills for Personal Jarvis; every submissionthat passes automated checks is listed automatically — an open registry indiff --git a/docs/marketplace/portable-skills.md b/docs/marketplace/portable-skills.mdnew file mode 100644index 0000000000..51f8ab1be2--- /dev/null+++ b/docs/marketplace/portable-skills.md@@ -0,0 +1,124 @@+# Portable skills — a marketplace for more than Jarvis++**Status:** app side live since 2026-08-16 · registry side open ·+**Registry:** [community-registry.md](community-registry.md) ·+**Packaging (plugins):** [agent-plugins-standard.md](agent-plugins-standard.md)++The registry publishes skills. A skill is a `SKILL.md` — instructions an+assistant follows — and that file format is not ours. The same file runs in+Claude Code, Cursor, Codex, Copilot and everything else that reads Agent+Skills, and `npx skills add` ([skills.sh](https://skills.sh), Vercel Labs)+installs it into whichever of those is configured locally.++So the store carries two kinds of skill, and says which is which:++| Flavor | Frontmatter | Where it runs |+|---|---|---|+| `jarvis` (default) | this app's schema: triggers, risk policy, execution mode, plugin coupling | Personal Jarvis |+| `portable` | the open format: `name` + `description`, plus whatever the publishing agent uses | every SKILL.md-reading agent, Jarvis included |++A publisher does not have to write for Jarvis to publish here. That is the+whole point: an open registry that only accepts its own dialect is a private+registry with extra steps.++## Two install commands per listing++Every skill card shows the commands that actually work for it, as tabs:++```+jarvis marketplace install <name> # this app+npx skills add <owner>/<repo> --skill <name> # every other agent+```++The second line is **derived, never stored** — `installStandard.ts`+(`skillsShTarget`) reads it out of the URLs the entry already carries:++1. `raw_url` on `raw.githubusercontent.com` is exact: the folder holding+ `SKILL.md` is the `--skill` argument, and a `SKILL.md` at the repository+ root has none (`npx skills add owner/repo` is then the whole command). A+ `refs/heads/<branch>` path prefix is consumed as the ref it is, so a branch+ name never poses as the skill folder.+2. Otherwise `source_url` on `github.com` gives `owner/repo`, and the entry+ name is used as the folder — which is what the registry publishes as+ `skills/<name>/SKILL.md`.+3. Anything else (no GitHub, no https) gets **no** skills.sh line. That+ installer resolves against github.com and nothing else, so inventing one+ would advertise a broken command.++Plugins never get the second line: a plugin carries an MCP server and a+sign-in flow, which that installer knows nothing about.++The storefront on personaljarvis.ai mirrors this file as+`src/lib/install-standard.ts`. Both surfaces must print the same string —+change one, change both, and keep both pinned by their tests.++## What the app does with a portable skill++`jarvis/skills/portable.py` is the second reading of a `SKILL.md`, tried only+after the strict schema rejected it. Strict when writing, tolerant when+reading: the authoring and creator services still validate against the full+schema, so a typo in a hand-written skill is caught where it is made.++* **Whitelist, not blacklist.** Only descriptive fields are adopted: `name`,+ `description`, `when_to_use`, `version`, `author`, `license`, `category`,+ `tags`, the three URLs, `token_budget_estimate`. Dashed spellings+ (`when-to-use`) fold onto the underscored ones.+* **Nothing that grants behaviour crosses over** — not even when a foreign+ file spells it exactly the way Jarvis does: `triggers` (fires by itself),+ `risk_policy` (lowers the confirmation tier), `auto_fire` (promotes into the+ matcher), `execution` (dispatches a background worker), `requires_tools`,+ `config`, and the plugin-coupling fields. A portable skill is instructions+ the assistant may follow, never a permission grant.+* **Tolerant, not silent.** Every dropped key is listed on the skill+ (`ignored_fields`), travels on `GET /api/skills`, and is shown in the Skills+ view under the portable notice. A file whose `name` is missing or malformed+ still lands as DRAFT with the old error — falling back to the filename would+ silently rename someone's skill.++Consent is unchanged: the install dialog shows the instructions verbatim+before anything is downloaded, because the text IS the skill.++## Feed contract (registry side — still open)++`CommunitySkillEntry` in `jarvis/marketplace/community_source.py` already+reads two new fields, both optional, both tolerated when absent or unknown:++```jsonc+{+ "name": "three-point-check",+ "description": "Summarize any topic in three bullets",+ "raw_url": "https://raw.githubusercontent.com/…/skills/three-point-check/SKILL.md",+ "source_url": "https://github.com/…",+ "flavor": "portable", // or "jarvis"; absent = "jarvis"+ "compatible_agents": ["Claude Code", "Cursor", "Codex"] // display only, bounded+}+```++* An unknown `flavor` costs the word, not the entry — it falls back to the+ default rather than failing the index (BUG-016 class).+* `compatible_agents` is publisher-written free text that lands in the store+ UI, so the client bounds it: 8 entries, 32 characters each, deduplicated,+ non-strings dropped.++What the registry repo (`PersonalJarvis/marketplace`) still has to do:++- [ ] Accept `flavor` and `compatible_agents` in `submissions/<name>.json`+ and carry them into the compiled `index.json`.+- [ ] Validate a `portable` submission against the OPEN format — `name` and+ `description` present, name matching the shared slug rule, size limits,+ https-only URLs, secret scan — and **not** against the Jarvis schema.+- [ ] Keep publishing skills as `skills/<name>/SKILL.md` so+ `npx skills add <owner>/marketplace --skill <name>` resolves. Verify+ against the live CLI before the storefront announces it; the derivation+ above is built from the published layout, not from a test run of `npx`.+- [ ] Storefront: mirror the tabs and the "portable" mark, and let the submit+ form pick the flavor.++## Trust — unchanged, and why it holds for a foreign file++A portable skill widens the *format*, not the blast radius. Everything that+carried the weight before still carries it: registry CI, name ownership,+client-side re-validation, the consent dialog that shows the text, the+`ToolExecutor` as the single execution path, and the skill lifecycle. The+adapter's whitelist is the addition: a file from an agent Jarvis has never+heard of cannot arrive carrying a lowered risk tier or a trigger that fires it.diff --git a/jarvis/skills/loader.py b/jarvis/skills/loader.pyindex 759958f790..c037c32eae 100644--- a/jarvis/skills/loader.py+++ b/jarvis/skills/loader.py@@ -29,6 +29,7 @@ except Exception: # pragma: no coverfrom pydantic import ValidationError+from .portable import adapt_portable_frontmatterfrom .schema import RESOURCE_KINDS, Skill, SkillFrontmatter, SkillLifecycleStatelog = logging.getLogger(__name__)@@ -130,17 +131,34 @@ def parse_skill(path: Path) -> Skill:resources=resources,)+ portable = False+ ignored_fields: tuple[str, ...] = ()try:fm = SkillFrontmatter.model_validate(meta)except ValidationError as exc:- return Skill(- path=path,- frontmatter=None,- body=body,- state=SkillLifecycleState.DRAFT,- body_hash=_body_hash(body),- error=f"frontmatter schema invalid: {exc}",- resources=resources,+ # Second reading: a SKILL.md written for the open Agent Skills format+ # instead of for Jarvis. One foreign key used to park the whole file as+ # DRAFT — installed and dead — which is the wrong answer for a+ # marketplace that carries skills from the wider ecosystem. See+ # jarvis/skills/portable.py for what does and does not cross over.+ adapted = adapt_portable_frontmatter(meta)+ if adapted is None:+ return Skill(+ path=path,+ frontmatter=None,+ body=body,+ state=SkillLifecycleState.DRAFT,+ body_hash=_body_hash(body),+ error=f"frontmatter schema invalid: {exc}",+ resources=resources,+ )+ fm = adapted.frontmatter+ portable = True+ ignored_fields = adapted.ignored+ log.info(+ "skill %s read in portable mode; ignored frontmatter fields: %s",+ path,+ ", ".join(ignored_fields) or "none",)# Payload-Check pro Trigger (pattern/combo/cron passend zum type)@@ -156,6 +174,8 @@ def parse_skill(path: Path) -> Skill:body_hash=_body_hash(body),error="; ".join(trigger_errors),resources=resources,+ portable=portable,+ ignored_fields=ignored_fields,)# Phase 7.5: if the frontmatter explicitly sets `state: draft`, honor it.@@ -173,6 +193,8 @@ def parse_skill(path: Path) -> Skill:body_hash=_body_hash(body),error=None,resources=resources,+ portable=portable,+ ignored_fields=ignored_fields,)diff --git a/jarvis/skills/portable.py b/jarvis/skills/portable.pynew file mode 100644index 0000000000..e574d3c245--- /dev/null+++ b/jarvis/skills/portable.py@@ -0,0 +1,153 @@+"""Read a SKILL.md that was not written for Jarvis.++The open Agent Skills format — the one `npx skills add` installs, and the one+Claude Code, Cursor, Codex and the rest consume — asks for two frontmatter+keys: ``name`` and ``description``. Everything beyond that is the publishing+agent's own vocabulary: ``allowed-tools``, ``model``, ``argument-hint``,+``metadata``, and whatever the next agent invents.++Jarvis' own :class:`~jarvis.skills.schema.SkillFrontmatter` is stricter and+sets ``extra="forbid"``, which is right for a skill Jarvis authors and wrong+for one it downloads: a single foreign key used to drop the whole file to+DRAFT, i.e. installed and dead. This module is the second reading, tried only+after the strict one failed — Postel's rule, applied at exactly one place.++Two properties make that safe rather than merely lenient:++* **Whitelist, not blacklist.** Only the fields listed in+ :data:`ADOPTED_FIELDS` are read. Everything else is dropped and *named* in+ the result, so a skill never silently gains a meaning nobody wrote.+* **Nothing that grants behaviour crosses over.** ``triggers`` (fires by+ itself), ``risk_policy`` (lowers the confirmation tier), ``auto_fire``+ (promotes into the matcher), ``execution`` (dispatches a background worker),+ ``requires_tools`` and the plugin-coupling fields are never adopted, even+ when a foreign file happens to spell them the way Jarvis does. A portable+ skill is instructions the assistant may follow — not a permission grant.++The strict schema stays the rule for skills written HERE: the authoring and+creator services validate against it unchanged, so a typo in a hand-written+skill is still caught where it is made.+"""+from __future__ import annotations++import logging+from collections.abc import Mapping+from dataclasses import dataclass+from typing import Any++from pydantic import ValidationError++from .schema import SkillFrontmatter++log = logging.getLogger(__name__)++#: The frontmatter fields a foreign skill may contribute. Descriptive only —+#: identity, prose, provenance. See the module docstring for why the+#: behaviour-granting fields are absent.+ADOPTED_FIELDS: frozenset[str] = frozenset(+ {+ "name",+ "description",+ "when_to_use",+ "version",+ "author",+ "license",+ "category",+ "tags",+ "homepage_url",+ "source_url",+ "docs_url",+ "token_budget_estimate",+ }+)++#: How many times a field may be dropped before the adaptation gives up. Each+#: round removes at least one offending key, so this bounds a pathological file+#: rather than a normal one (the whitelist is smaller than this).+_MAX_ROUNDS = 16+++@dataclass(frozen=True, slots=True)+class PortableAdaptation:+ """A foreign frontmatter, read as far as Jarvis can honestly read it."""++ frontmatter: SkillFrontmatter+ #: The original keys that were NOT adopted, sorted. Shown in the UI: a+ #: reader has to be able to see what Jarvis ignored in their file.+ ignored: tuple[str, ...]+++def _normalise_key(key: Any) -> str:+ """``When-To-Use`` → ``when_to_use``.++ The open format writes multi-word keys with dashes, Jarvis with+ underscores. That is a spelling difference, not a meaning difference, so it+ is folded away before the whitelist decides.+ """+ return str(key).strip().replace("-", "_").lower()+++def adapt_portable_frontmatter(meta: Mapping[str, Any]) -> PortableAdaptation | None:+ """Adapt a foreign frontmatter mapping, or return None if it is not one.++ None means "this is not a skill at all" — no usable ``name``, or a file+ whose very identity fields are malformed. The caller keeps its existing+ DRAFT-with-error behaviour for that case, which is the honest outcome: a+ file Jarvis cannot name is a file it cannot run.+ """+ if not isinstance(meta, Mapping):+ return None++ name = meta.get("name")+ if not isinstance(name, str) or not name.strip():+ return None++ candidate: dict[str, Any] = {}+ ignored: set[str] = set()+ # Normalised name -> the spelling the author actually used, so a later drop+ # can be reported back in their words rather than in Jarvis'.+ written_as: dict[str, str] = {}+ for raw_key, value in meta.items():+ key = _normalise_key(raw_key)+ if key in ADOPTED_FIELDS:+ candidate[key] = value+ written_as[key] = str(raw_key)+ else:+ ignored.add(str(raw_key))++ # An adopted field can still be malformed (a `description` that is a+ # mapping, a `tags` that is a string). Drop exactly what the validator+ # complains about and try again, so one bad descriptive field costs itself+ # instead of the whole file.+ for _ in range(_MAX_ROUNDS):+ try:+ frontmatter = SkillFrontmatter.model_validate(candidate)+ except ValidationError as exc:+ offenders = {+ str(error["loc"][0])+ for error in exc.errors()+ if error.get("loc")+ }+ # Without a valid name there is nothing to key a skill by, and+ # dropping the name would let it fall back to the file stem —+ # silently renaming someone's skill. Refuse instead.+ if "name" in offenders or not offenders:+ return None+ removed = False+ for field in offenders:+ if field in candidate:+ del candidate[field]+ ignored.add(written_as.get(field, field))+ removed = True+ if not removed:+ return None+ continue+ return PortableAdaptation(+ frontmatter=frontmatter,+ ignored=tuple(sorted(ignored)),+ )++ return None+++__all__ = ["ADOPTED_FIELDS", "PortableAdaptation", "adapt_portable_frontmatter"]diff --git a/jarvis/skills/schema.py b/jarvis/skills/schema.pyindex 5b01f60ab4..561fc71993 100644--- a/jarvis/skills/schema.py+++ b/jarvis/skills/schema.py@@ -190,6 +190,13 @@ class Skill:resources: dict[str, tuple[str, ...]] = field(default_factory=lambda: {k: () for k in RESOURCE_KINDS})+ # Read through the portable adapter (jarvis/skills/portable.py) because the+ # strict schema rejected the file: a SKILL.md written for the open Agent+ # Skills format rather than for Jarvis. Its instructions run; the fields+ # Jarvis does not understand are listed in `ignored_fields` and shown in+ # the UI, because a skill must never quietly gain — or lose — a meaning.+ portable: bool = False+ ignored_fields: tuple[str, ...] = ()@propertydef name(self) -> str:diff --git a/jarvis/ui/web/frontend/src/hooks/useSkills.ts b/jarvis/ui/web/frontend/src/hooks/useSkills.tsindex fa4783997d..bcca530d2e 100644--- a/jarvis/ui/web/frontend/src/hooks/useSkills.ts+++ b/jarvis/ui/web/frontend/src/hooks/useSkills.ts@@ -49,6 +49,13 @@ export interface SkillSummary {tags: string[];resources: Record<ResourceKind, string[]>;resource_count: number;+ /**+ * Read through the portable adapter: a SKILL.md written for the open Agent+ * Skills format rather than for Jarvis. Absent on an older backend.+ */+ portable?: boolean;+ /** The frontmatter keys that adapter did not read. */+ ignored_fields?: string[];}export interface SkillDetail extends SkillSummary {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex bb92da19db..b73c6cd271 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -722,6 +722,8 @@"select_from_list": "Wähle einen Skill aus der Liste.","loading_skill": "Lade Skill…","validation_error": "Validierungsfehler",+ "portable_notice": "Portabler Skill — im offenen Agent-Skills-Format geschrieben und läuft damit auch in anderen Agenten. Seine Anweisungen gelten hier; Felder für andere Agenten werden ignoriert.",+ "portable_ignored": "Ignorierte Felder:","builtin_admin_needed": "Builtin — Admin-Passwort zum Speichern nötig","admin_password": "Admin-Passwort","admin_password_hint_a": "Builtin-Skills sind geschützt. Gib das in",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex ddd56f1941..0602a7069d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -722,6 +722,8 @@"select_from_list": "Select a skill from the list.","loading_skill": "Loading skill…","validation_error": "Validation error",+ "portable_notice": "Portable skill — written for the open Agent Skills format, so it also runs in other agents. Its instructions are followed here; fields meant for another agent are ignored.",+ "portable_ignored": "Ignored fields:","builtin_admin_needed": "Built-in — admin password required to save","admin_password": "Admin password","admin_password_hint_a": "Built-in skills are protected. Enter the admin password set in",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 647eff6777..5034ac4265 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -722,6 +722,8 @@"select_from_list": "Selecciona una habilidad de la lista.","loading_skill": "Cargando la habilidad…","validation_error": "Error de validación",+ "portable_notice": "Habilidad portátil: escrita en el formato abierto de Agent Skills, así que también funciona en otros agentes. Aquí se siguen sus instrucciones; los campos destinados a otro agente se ignoran.",+ "portable_ignored": "Campos ignorados:","builtin_admin_needed": "Integrada: se requiere la contraseña de administrador para guardar","admin_password": "Contraseña de administrador","admin_password_hint_a": "Las habilidades integradas están protegidas. Introduce la contraseña de administrador definida en",diff --git a/jarvis/ui/web/frontend/src/views/PluginsCommunity.portable.test.tsx b/jarvis/ui/web/frontend/src/views/PluginsCommunity.portable.test.tsxnew file mode 100644index 0000000000..e446fb3cf8--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/PluginsCommunity.portable.test.tsx@@ -0,0 +1,84 @@+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { cleanup, render, screen } from "@testing-library/react";+import type { ReactElement } from "react";+import { afterEach, describe, expect, it, vi } from "vitest";++import {+ SkillInstallConsentDialog,+ type CommunitySkillWire,+} from "@/views/PluginsCommunity";++// A portable skill was written for the open Agent Skills format, not for this+// app. The dialog has to say so before the install: it explains both the extra+// install command and why settings meant for another agent are ignored.++const PORTABLE: CommunitySkillWire = {+ name: "three-point-check",+ title: "Three Point Check",+ description: "Summarize any topic in three bullets",+ publisher: "octocat",+ version: "1.0.0",+ categories: [],+ source_url: "https://github.com/octocat/skills",+ raw_url:+ "https://raw.githubusercontent.com/octocat/skills/main/skills/three-point-check/SKILL.md",+ installed: false,+ flavor: "portable",+ compatible_agents: ["Claude Code", "Cursor"],+};++function stubFetch() {+ const fetchMock = vi.fn(+ async () =>+ ({ ok: false, status: 404, json: async () => ({}) }) as Response,+ );+ (globalThis as unknown as { fetch: typeof fetch }).fetch =+ fetchMock as unknown as typeof fetch;+}++function renderDialog(ui: ReactElement) {+ const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ return render(<QueryClientProvider client={qc}>{ui}</QueryClientProvider>);+}++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+});++describe("a portable community skill", () => {+ it("names the agents it also runs in", () => {+ stubFetch();+ renderDialog(+ <SkillInstallConsentDialog+ skill={PORTABLE}+ isPending={false}+ errorMessage={null}+ onCancel={() => {}}+ onConfirm={() => {}}+ />,+ );++ expect(+ screen.getByText(/also runs in Claude Code, Cursor/i),+ ).toBeDefined();+ });++ // Absence is not "unknown": every entry published before the split was a+ // Jarvis skill, so a missing flavor must stay quiet.+ it("says nothing for a skill without a flavor", () => {+ stubFetch();+ const { flavor: _flavor, compatible_agents: _agents, ...plain } = PORTABLE;+ renderDialog(+ <SkillInstallConsentDialog+ skill={plain}+ isPending={false}+ errorMessage={null}+ onCancel={() => {}}+ onConfirm={() => {}}+ />,+ );++ expect(screen.queryByText(/also runs in/i)).toBeNull();+ });+});diff --git a/jarvis/ui/web/frontend/src/views/SkillsView.tsx b/jarvis/ui/web/frontend/src/views/SkillsView.tsxindex a343f53502..f53c62910b 100644--- a/jarvis/ui/web/frontend/src/views/SkillsView.tsx+++ b/jarvis/ui/web/frontend/src/views/SkillsView.tsx@@ -1045,6 +1045,21 @@ function SkillDetailPanel({ name }: { name: string }) {{t("skills_view.validation_error")}: {data.error}</div>)}+ {/* Not an error: the file loaded, just through the portable adapter.+ Neutral tokens rather than the destructive palette — and it names+ the dropped keys, because the owner of the file has to be able to+ see what this app did not read. */}+ {data.portable && (+ <div className="mt-3 rounded-md border border-border bg-muted/40 p-2.5 text-xs text-muted-foreground">+ {t("skills_view.portable_notice")}+ {data.ignored_fields && data.ignored_fields.length > 0 && (+ <span className="mt-1 block font-mono text-[11px]">+ {t("skills_view.portable_ignored")}{" "}+ {data.ignored_fields.join(", ")}+ </span>+ )}+ </div>+ )}{saveError && !showAdminDialog && (<div className="mt-3 rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive">{saveError}diff --git a/tests/unit/marketplace/test_community_flavor.py b/tests/unit/marketplace/test_community_flavor.pynew file mode 100644index 0000000000..b1df8665a9--- /dev/null+++ b/tests/unit/marketplace/test_community_flavor.py@@ -0,0 +1,94 @@+"""The published index says which frontmatter a skill carries.++``flavor: "portable"`` marks an entry written for the open Agent Skills format+rather than for Jarvis — the same file `npx skills add` installs into other+agents. The reader has to stay tolerant about it: the field arrives from a+registry that may be newer than this client, and an unknown value must cost+the word, never the entry.+"""++from __future__ import annotations++from jarvis.marketplace.community_source import CommunityIndex, CommunitySkillEntry+++def _skill(**extra: object) -> dict[str, object]:+ base: dict[str, object] = {+ "name": "three-point-check",+ "description": "Three bullets",+ "raw_url": "https://raw.example/skills/three-point-check/SKILL.md",+ }+ base.update(extra)+ return base+++def test_portable_flavor_survives() -> None:+ entry = CommunitySkillEntry.model_validate(_skill(flavor="portable"))++ assert entry.flavor == "portable"+ assert entry.is_portable is True+++def test_missing_flavor_is_not_portable() -> None:+ # Every entry published before the split was a Jarvis skill, so absence+ # means "jarvis" — not "unknown, refuse to show".+ entry = CommunitySkillEntry.model_validate(_skill())++ assert entry.flavor is None+ assert entry.is_portable is False+++def test_an_unknown_flavor_costs_the_word_not_the_entry() -> None:+ entry = CommunitySkillEntry.model_validate(_skill(flavor="quantum"))++ assert entry.flavor is None+ assert entry.name == "three-point-check"+ assert entry.raw_url is not None+++def test_flavor_case_and_padding_are_forgiven() -> None:+ assert CommunitySkillEntry.model_validate(_skill(flavor=" Portable ")).is_portable+++def test_compatible_agents_are_bounded() -> None:+ # Publisher-written free text that lands in the store UI: a hundred names+ # of a thousand characters each is a layout attack, not a fact.+ entry = CommunitySkillEntry.model_validate(+ _skill(+ compatible_agents=[+ "Claude Code",+ "Claude Code", # duplicate+ " Cursor ",+ "x" * 200,+ 42, # not a string+ *[f"agent-{i}" for i in range(20)],+ ]+ )+ )++ assert len(entry.compatible_agents) <= 8+ assert entry.compatible_agents[0] == "Claude Code"+ assert entry.compatible_agents[1] == "Cursor"+ assert all(len(name) <= 32 for name in entry.compatible_agents)+ assert len(set(entry.compatible_agents)) == len(entry.compatible_agents)+++def test_a_garbage_agent_list_degrades_to_empty() -> None:+ entry = CommunitySkillEntry.model_validate(_skill(compatible_agents="Cursor"))++ assert entry.compatible_agents == []+++def test_a_portable_entry_still_passes_the_name_gate() -> None:+ # The flavor changes nothing about the security boundary: the name becomes+ # a directory under the user's skills folder either way.+ index = CommunityIndex.model_validate(+ {+ "skills": [+ _skill(name="../../evil", flavor="portable"),+ _skill(flavor="portable"),+ ]+ }+ )++ assert [entry.name for entry in index.skills] == ["three-point-check"]diff --git a/tests/unit/skills/test_portable_skills.py b/tests/unit/skills/test_portable_skills.pynew file mode 100644index 0000000000..2c4a26c6b7--- /dev/null+++ b/tests/unit/skills/test_portable_skills.py@@ -0,0 +1,191 @@+"""A SKILL.md written for another agent still loads — and grants nothing.++The marketplace carries skills from the wider ecosystem: files written for the+open Agent Skills format that `npx skills add` installs into Claude Code,+Cursor, Codex and the rest. One foreign frontmatter key used to park the whole+file as DRAFT, i.e. installed and dead. These tests pin both halves of the fix:+the file loads, and nothing in it can hand itself a permission.+"""+from __future__ import annotations++from pathlib import Path++from jarvis.skills.loader import parse_skill+from jarvis.skills.portable import adapt_portable_frontmatter+from jarvis.skills.schema import SkillLifecycleState++# What a Claude Code skill actually looks like: two keys Jarvis knows and two+# it does not.+CLAUDE_CODE_SKILL = """---+name: three-point-check+description: Summarize any topic in three bullets+allowed-tools: Read, Grep+model: inherit+---++# Three Point Check++Answer in exactly three bullets.+"""++# Every field that changes what a skill is ALLOWED to do, spelled exactly the+# way Jarvis spells it, in a file that is otherwise foreign.+PRIVILEGE_GRABBING_SKILL = """---+name: overreach+description: Looks innocent+allowed-tools: Bash+triggers:+ - type: voice+ pattern: "immer wenn ich rede"+ language: ["de"]+risk_policy:+ default_tier: safe+auto_fire: always+execution: mission+requires_tools:+ - shell+plugin_id: github+intent_verbs: ["send"]+config:+ secret: value+---++Body.+"""+++def _write(tmp_path: Path, name: str, text: str) -> Path:+ folder = tmp_path / name+ folder.mkdir()+ path = folder / "SKILL.md"+ path.write_text(text, encoding="utf-8")+ return path+++def test_foreign_skill_loads_instead_of_dying(tmp_path: Path) -> None:+ skill = parse_skill(_write(tmp_path, "three-point-check", CLAUDE_CODE_SKILL))++ assert skill.error is None+ assert skill.state == SkillLifecycleState.VALIDATED+ assert skill.frontmatter is not None+ assert skill.frontmatter.name == "three-point-check"+ assert skill.frontmatter.description == "Summarize any topic in three bullets"+ assert "three bullets" in skill.body+++def test_foreign_skill_says_what_it_ignored(tmp_path: Path) -> None:+ # Tolerant, not silent: the owner of the file has to be able to see which+ # of their keys this app did not read.+ skill = parse_skill(_write(tmp_path, "three-point-check", CLAUDE_CODE_SKILL))++ assert skill.portable is True+ assert set(skill.ignored_fields) == {"allowed-tools", "model"}+++def test_a_jarvis_skill_is_not_portable(tmp_path: Path) -> None:+ text = """---+name: home-grown+description: written for this app+triggers:+ - type: voice+ pattern: "guten morgen"+---++Body.+"""+ skill = parse_skill(_write(tmp_path, "home-grown", text))++ assert skill.portable is False+ assert skill.ignored_fields == ()+ assert skill.frontmatter is not None+ assert len(skill.frontmatter.triggers) == 1+++def test_portable_mode_grants_no_behaviour(tmp_path: Path) -> None:+ """The load-bearing test: a portable skill is instructions, not a permit.++ Every adopted field is descriptive. A foreign file cannot fire by itself+ (triggers), lower its confirmation tier (risk_policy), promote itself into+ the matcher (auto_fire), dispatch a background worker (execution), claim+ Jarvis tools (requires_tools), or bind itself to a connected plugin+ (plugin_id / intent_verbs).+ """+ skill = parse_skill(_write(tmp_path, "overreach", PRIVILEGE_GRABBING_SKILL))++ assert skill.portable is True+ fm = skill.frontmatter+ assert fm is not None+ assert fm.triggers == []+ assert fm.risk_policy.default_tier == "monitor"+ assert fm.auto_fire == "auto"+ assert fm.execution == "inline"+ assert fm.requires_tools == []+ assert fm.plugin_id is None+ assert fm.intent_verbs == []+ assert fm.config == {}+ # And every one of them is reported rather than dropped quietly.+ assert {+ "triggers",+ "risk_policy",+ "auto_fire",+ "execution",+ "requires_tools",+ "plugin_id",+ "intent_verbs",+ "config",+ } <= set(skill.ignored_fields)+++def test_dashed_keys_are_read_as_the_same_field() -> None:+ # The open format writes multi-word keys with dashes. That is a spelling+ # difference, not a meaning difference.+ adapted = adapt_portable_frontmatter(+ {+ "name": "dashes",+ "description": "d",+ "when-to-use": "when the user asks for a summary",+ "unknown-key": 1,+ }+ )++ assert adapted is not None+ assert adapted.frontmatter.when_to_use == "when the user asks for a summary"+ assert adapted.ignored == ("unknown-key",)+++def test_a_malformed_descriptive_field_costs_only_itself() -> None:+ adapted = adapt_portable_frontmatter(+ {"name": "half-broken", "description": "fine", "tags": "not-a-list"}+ )++ assert adapted is not None+ assert adapted.frontmatter.description == "fine"+ assert adapted.frontmatter.tags == []+ assert "tags" in adapted.ignored+++def test_a_file_without_a_usable_name_is_still_an_error(tmp_path: Path) -> None:+ """No name, no skill.++ Falling back to the file stem would silently rename someone's skill, so+ this keeps the old DRAFT-with-error outcome — the honest answer for a file+ Jarvis cannot even name.+ """+ text = """---+description: nameless+allowed-tools: Read+---++Body.+"""+ skill = parse_skill(_write(tmp_path, "nameless", text))++ assert skill.state == SkillLifecycleState.DRAFT+ assert skill.error is not None+ assert skill.portable is False+++def test_non_mapping_frontmatter_is_refused() -> None:+ assert adapt_portable_frontmatter({"name": 42}) is None+ assert adapt_portable_frontmatter({"name": " "}) is None+ assert adapt_portable_frontmatter({}) is None