Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@ publication follows the [release checklist](Documentation/Reference/Release.md).

## Unreleased

## 0.3.2

### Added

- Support `kind: hostPlugin` declarations for Codex, Claude Code, and Antigravity
in `agents.yaml` with explicit recipient validation and manifest schema
generation.
- Add `HostPluginExecutor` in `AgentsUpdates` for read-only filesystem
inspection and preview (`inspect`, `preview`) plus explicit, lock-external host
plugin synchronization (`sync(apply:)`), using `OwnedDuplexProcess` with closed
stdin, bounded timeouts, and mandatory filesystem readback after every command.
- Add `SkillGovernance.inspect` in `AgentsUpdates` for deterministic doctor
checks covering host plugin drift, unmanaged legacy Codex shared-root symlinks,
realpath-resolved plugin-vs-standalone skill collisions, and per-host UTF-8
always-visible skill listing estimates (supporting
`SLASH_COMMAND_TOOL_CHAR_BUDGET` for Claude Code).
- Recognize portable root `plugin.json` manifests declaring the exact Agent
Plugins 1.0 `$schema`, coalesce dual `.claude-plugin/plugin.json` + root
`plugin.json` bundles into a single catalog entry, and discover skills through
`.agents/plugins/marketplace.json`.

### Changed

- Route new user-scope Codex skill deployments to `$CODEX_HOME/skills`
(`~/.codex/skills`) under a dedicated `skills-codex-private` ledger root while
preserving historical ledger and journal paths. Selected deployments migrate
after ownership and destination checks. Unselected deployments retain their
recorded paths, and leaves shared with other agents retain their ownership.
- Include `~/.agents/skills` in `AgentRegistry.nativeUserScanDirectories` for
Antigravity.

## 0.3.1

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion Documentation/Architecture/NativeDocuments.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ Before entering the C parser, the entire input must fit the caller's maximum
uninterrupted-byte envelope. This covers strings, keys, skipped comments and
whitespace alike. The fixed grammar also reserves a conservative logical node
envelope of four nodes per input byte plus the document root before CST entry;
traversal and progress callbacks consume additional work. The progress callback
traversal and progress callbacks consume additional work. Callers configuring
`NativeDocumentBudget` must scale `nodes` with `maximumBytes` (strictly above
`4 * maximumBytes + 1` plus traversal work, rather than a flat constant below
that expansion) and exercise parsers at realistic host-configuration byte
scales. The progress callback
checks the same cancellation source and budget between parser work intervals.
All parser/tree handles are synchronously released on every exit.

Expand Down
57 changes: 52 additions & 5 deletions Documentation/Architecture/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,14 @@ manifest and its project scope.
`SkillOperations.watchOperations()`, and declaration access by
`AgentsManifest`. See [Watch](Watch.md) for the public API.
- `AgentRegistry` owns agent skill locations. `RuntimeEnvironment` supplies the
project root, home directory and environment. Universal agent skill locations
can be shared, so recipients sharing one directory must agree on install mode.
project root, home directory and environment. New Codex user deployments use
`$CODEX_HOME/skills` (default `~/.codex/skills`). The `skills-codex-private`
ledger root and `codex-private` journal root identify that location.
User-scope `skills-codex` ledger entries and `codex` journal paths continue
to identify `~/.agents/skills`, which Antigravity also scans. Migration
verifies legacy ownership and destination availability, and retains a shared
leaf while another deployment owns it. Recipients that share a physical
destination agree on install mode.
- `FileHash` hashes tree entries, hidden files and symlink destinations;
`PathSafety` checks paths and creates filesystem skill identities.

Expand Down Expand Up @@ -172,8 +178,8 @@ continue to use `CoreError.commandFailed`; process launch errors retain their
underlying platform error.

`OwnedDuplexProcess` takes explicit argv, cwd, environment and PATH. Its CPlatform
spawn closes nonstandard child descriptors and creates a separate process group;
it never inherits transaction locks. The owner closes stdin, waits a finite grace,
spawn closes nonstandard child descriptors except explicitly inherited descriptors
and creates a separate process group; it never inherits transaction locks. The owner closes stdin, waits a finite grace,
signals TERM/KILL while the unreaped leader reserves its identity, and confirms
reap with nonblocking waits. It refuses auto-reaping SIGCHLD configurations and
reports ownership loss or unconfirmed cleanup. Darwin inspects only the reserved
Expand Down Expand Up @@ -439,13 +445,54 @@ empty containers. Opaque registration requires the exact container name from ada
metadata; unresolved requirements remain visible and cannot be selected. Member
units carry typed kind selections and byte-exact sibling exclusions. Importer
keys retain the adapter's complete family effects, fixed contributions, requirements
and separate producer selection claims. Captured content and paths remain source-
and separate producer selection claims. The Agent Plugins 1.0 manifest schema
identifies a portable root `plugin.json`. When a bundle also has a Claude
manifest, components mode uses the Claude document once and validates agreement
between the declared names. Portable skills inherit the plugin declaration’s
recipients and use standalone skill routes on hosts without a generated
container for the selected scope. Captured content and paths remain source-
relative; borrowed extraction URLs never escape. Empty selection yields no addition.
Destination-bound composition, pin protection and publication remain in AgentsUpdates;
the package catalog does not create update requests.

## AgentsUpdates

`HostPluginExecutor.inspect` and `preview` use the runtime's local filesystem
and NativeDocuments to observe host installations and report exact command
arguments and settings changes. `sync(apply: true)` executes vendor commands
outside scope and shared-resource locks. It observes host state after each
command, including failures, timeouts, and cancellation of an in-flight
command. Cancellation preserves completed results. Codex and Antigravity
project settings changes use recoverable native file publication. Codex uses
the existing config coordination routes and defers to any private MCP
materialization receipt on the same file. A separate per-target advisory lock
excludes private Codex receipt publication through command readback. The Codex
child inherits the locked open file description and retains exclusion if it
outlives the caller. Codex preflight and readback verify existing receipt
evidence, including on no-op syncs. Project settings edits require a physical
destination within project authority. Claude Code uses host commands with its
selected user, project, or local scope.

The manifest's `hostPlugin` declaration takes explicit recipients and either
a marketplace ID or one source-backed bundle. Source-backed inspection reads a
local checkout, including active exported groups from local producers. Stored
bundle exports come from a verified snapshot. Existing registrations are
reconciled against the host marketplace origin or registered project bundle
path. Conflicting enablement declarations for one host, scope and plugin ID
are surfaced before execution.
The combined update graph continues to freeze and replay `kind: plugin`
through its existing resource and transaction path.

`SkillGovernance.inspect` compares declared host plugin state with observed
installation and enablement, and checks the merged project and user scan roots
against effectively enabled plugin skills. Collisions report parsed names and
physical file identity, with host-visible plugin namespaces for Antigravity and
Claude Code. Its advisory budgets estimate the UTF-8 bytes of
deduplicated names and descriptions, excluding per-skill framing and host
built-ins. The default advisory threshold is 8,000. Claude Code can supply a
threshold through `SLASH_COMMAND_TOOL_CHAR_BUDGET`. The optional budgets are
omitted when there are no skills or recovery is pending.

`MCPRegistry` reads MCP Registry v0.1 pages and exact server versions. Request
credentials stay in the registry's in-memory HTTP transport. Each returned choice
captures a portable configuration. Selection admits explicit recipients through
Expand Down
11 changes: 11 additions & 0 deletions Documentation/Architecture/State.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ metadata under that parent lives in `.agents-native/<physical-key>/`, containing
a persistent `lock`, authoritative private `receipt` and transient `reservation`.
The receipt records one physical file's generation, digest, root identity and
access evidence. Shared files have no second authoritative scope receipt.

Metadata, lock, receipt and reservation access are verified through opened
nofollow descriptors. A conflicting or unprovable domain stops publication.

Expand Down Expand Up @@ -625,6 +626,16 @@ or reservations. They diagnose pending recovery without replay. External native
clients do not participate in these locks: preimage, digest, identity and access
changes cause freshness conflicts rather than overwriting client siblings.

Codex vendor commands and private receipt publishers share a separate advisory
lock at `.agents-host-commands/config.toml.lock` under the physical settings
parent. The host takes it before a brief scope read, runs the command with scope
and shared-resource locks released, and keeps the advisory lock through
readback. The Codex child inherits the locked open file description, so a child
that survives its parent continues to exclude writers until the last copy
closes. Managed writers try the host lock without waiting and retain it through
commit or rollback. A contended writer stops before publishing settings or a
receipt and can retry after the host lock is released.

E supplies the complete new/old deployment footprint and redacted composition;
F supplies exact owned-region edits and route semantics. These Core registrations
do not claim native parser, adapter or real-client acceptance.
Expand Down
36 changes: 36 additions & 0 deletions Documentation/Reference/ManifestSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,34 @@ Declare a plugin resource for native installation or component expansion.
| `select` | | sequence of `skills` / `instructions` / `mcpServer` / `hook` / `subagent` / `command` / `lspServer` / `permissions` / `ignore` / `plugin` (at most 10000 items) | Component kinds to include during components-mode expansion. Omission leaves kinds unrestricted; an empty sequence selects none. Duplicate kinds are errors. |
| `exclude` | | sequence of componentReference (at most 10000 items) | Typed individual members removed from components-mode expansion. Omission or an empty sequence excludes none. Each kind/name pair must be unique. |

## component_hostPluginID

Declare a plugin for explicit host synchronization.

| Field | Required | Shape | Description |
| --- | --- | --- | --- |
| `kind` | yes | `hostPlugin` | Selects a plugin managed by an explicit host synchronization. |
| `name` | yes | string | Symbolic name of the declaration. |
| `agents` | yes | sequence of agent (exactly 1 item) | One explicit recipient for the marketplace plugin. |
| `enabled` | | boolean | Desired host enablement. Omission defaults to true. |
| `claudeScope` | | `user` / `project` / `local` | Claude Code scope. Omission uses the selected agents scope. |
| `pluginId` | yes | string | Host plugin ID. |
| `marketplace` | | string | Optional marketplace URL or path. |

## component_hostPluginBundle

Declare a plugin for explicit host synchronization.

| Field | Required | Shape | Description |
| --- | --- | --- | --- |
| `kind` | yes | `hostPlugin` | Selects a plugin managed by an explicit host synchronization. |
| `name` | yes | string | Symbolic name of the declaration. |
| `agents` | yes | sequence of agent (1 to 10000 items) | One or more explicit recipients for the bundle. |
| `enabled` | | boolean | Desired host enablement. Omission defaults to true. |
| `claudeScope` | | `user` / `project` / `local` | Claude Code scope. Omission uses the selected agents scope. |
| `source` | yes | string | Source alias containing the plugin bundle. |
| `path` | yes | string | Relative path to one plugin directory. |

## component

One component declaration, selected by its required kind. All fields are checked even when the component is inactive; target-client support is evaluated by the consuming operation.
Expand Down Expand Up @@ -645,6 +673,14 @@ component_ignore

component_plugin

### Alternative 11

component_hostPluginID

### Alternative 12

component_hostPluginBundle

## use

Activate a local group or an exported group from a source. Uses retain order and occurrences; nested conditions intersect and source aliases remain local to their declaring document.
Expand Down
20 changes: 17 additions & 3 deletions Scripts/generate-manifest-schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def allow(keys):
raise ValueError('enum must contain unique strings')
return '.enumeration([' + ', '.join(q(x) for x in choices) + '])'
kind = value.get('type')
if kind == 'boolean':
allow({'type'})
return '.boolean'
if kind == 'string':
allow({'type'})
return '.string'
Expand All @@ -90,11 +93,15 @@ def allow(keys):
bounds += ', maximum: ' + integer(value['maximum'], 'maximum')
return '.integer(' + bounds + ')'
if kind == 'array':
allow({'type', 'items', 'maxItems'})
allow({'type', 'items', 'minItems', 'maxItems'})
if 'items' not in value:
raise ValueError('arrays require an item shape')
minimum = integer(value['minItems'], 'minItems', 0) if 'minItems' in value else None
maximum = integer(value['maxItems'], 'maxItems', 0) if 'maxItems' in value else 'nil'
return '.array(' + emit(value['items'], definitions) + ', maximum: ' + maximum + ')'
if minimum is not None and maximum != 'nil' and int(minimum) > int(maximum):
raise ValueError('minItems cannot exceed maxItems')
bounds = (', minimum: ' + minimum if minimum is not None else '') + ', maximum: ' + maximum
return '.array(' + emit(value['items'], definitions) + bounds + ')'
if kind == 'object':
allow({'type', 'properties', 'required', 'additionalProperties', 'maxProperties'})
maximum = integer(value['maxProperties'], 'maxProperties', 0) if 'maxProperties' in value else 'nil'
Expand Down Expand Up @@ -132,7 +139,14 @@ def describe(value):
kind = value['type']
if kind == 'array':
shape = 'sequence of ' + describe(value['items'])
return shape + (f" (at most {value['maxItems']} items)" if 'maxItems' in value else '')
minimum = value.get('minItems')
maximum = value.get('maxItems')
if minimum is not None and maximum is not None:
return shape + (f" (exactly {minimum} {'item' if minimum == 1 else 'items'})" if minimum == maximum
else f" ({minimum} to {maximum} items)")
if minimum is not None:
return shape + f" (at least {minimum} items)"
return shape + (f" (at most {maximum} items)" if maximum is not None else '')
if kind == 'object':
shape = ('name → ' + describe(value['additionalProperties'])
if isinstance(value['additionalProperties'], dict) else 'mapping')
Expand Down
18 changes: 18 additions & 0 deletions Scripts/test_manifest_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Guard the bundled schema compiler's accepted validation semantics."""
import copy
import importlib.util
import json
import unittest
from pathlib import Path

Expand Down Expand Up @@ -56,6 +57,23 @@ def test_schema_values_drive_runtime_constraints_and_help(self):
for expected in ['`2`', 'at most 3 items', 'at most 4 properties', 'at most 0 properties', 'integer ≥ 5']:
self.assertIn(expected, help_text)

def test_host_plugin_recipients_are_required_and_bounded_by_selector(self):
schema = json.loads((Path(__file__).parents[1] /
'Sources/AgentsManifest/Resources/agents.schema.json').read_text())
marketplace = schema['$defs']['component_hostPluginID']
bundle = schema['$defs']['component_hostPluginBundle']
self.assertIn('agents', marketplace['required'])
self.assertIn('agents', bundle['required'])
self.assertEqual(marketplace['properties']['agents']['minItems'], 1)
self.assertEqual(marketplace['properties']['agents']['maxItems'], 1)
self.assertEqual(bundle['properties']['agents']['minItems'], 1)
swift, help_text = compiler.compile_schema(schema)
self.assertIn('minimum: 1, maximum: 1)', swift)
self.assertIn('exactly 1 item', help_text)
with self.assertRaises(ValueError):
compiler.emit({'type': 'array', 'items': {'type': 'string'},
'minItems': 2, 'maxItems': 1}, {})

def test_validation_siblings_are_not_discarded(self):
for shape in [{'$ref': '#/$defs/string'}, {'oneOf': [{'type': 'string'}]},
{'x-agents-native-value': True}, {'const': 'a'}, {'enum': ['a']}]:
Expand Down
3 changes: 3 additions & 0 deletions Sources/AgentsCore/AgentPluginManifest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package enum AgentPluginManifest {
package static let schema = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"
}
25 changes: 21 additions & 4 deletions Sources/AgentsCore/AgentRegistry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ package enum AgentRegistry {
return projectSkillsDirectory(for: agent, environment: environment).standardizedFileURL.path
== canonical
case .user:
return agent != .antigravity
return agent != .antigravity && agent != .codex
&& usesUniversalProjectSkillsDirectory(for: agent, environment: environment)
}
}
Expand All @@ -159,6 +159,25 @@ package enum AgentRegistry {
return skillsDirectory(for: agent, scope: scope, environment: environment)
}

package static func skillRootKey(for agent: AgentID, scope: InstallScope) -> String {
"skills-" + (scope == .user && agent == .codex ? "codex-private" : agent.rawValue)
}

package static func skillRoot(
_ key: String, scope: InstallScope, environment: RuntimeEnvironment
) -> (agent: AgentID, directory: URL)? {
if scope == .user && key == "skills-codex-private" {
return (.codex, userSkillsDirectory(for: .codex, environment: environment))
}
guard key.hasPrefix("skills-"), let agent = AgentID(rawValue: String(key.dropFirst(7))),
agent.supportsSkills
else { return nil }
if scope == .user && agent == .codex {
return (agent, canonicalSkillsDirectory(scope: scope, environment: environment))
}
return (agent, installSkillsDirectory(for: agent, scope: scope, environment: environment))
}

package static func projectSkillsDirectory(for agent: AgentID, environment: RuntimeEnvironment)
-> URL
{
Expand Down Expand Up @@ -205,15 +224,13 @@ package enum AgentRegistry {
for agent: AgentID, environment: RuntimeEnvironment
) -> [URL] {
switch agent {
case .codex, .cursor, .geminiCLI, .opencode:
case .codex, .cursor, .geminiCLI, .opencode, .antigravity:
return [
userSkillsDirectory(for: agent, environment: environment),
environment.homeDirectory.appendingPathComponent(".agents/skills"),
]
case .claudeCode:
return [userSkillsDirectory(for: agent, environment: environment)]
case .antigravity:
return [userSkillsDirectory(for: agent, environment: environment)]
}
}

Expand Down
Loading
Loading