From 75009ef3211d51ec4013c7d5e6d8f99a1c3185e0 Mon Sep 17 00:00:00 2001 From: showxu <10173746+showxu@users.noreply.github.com> Date: Sun, 29 Nov 2026 16:50:01 +0800 Subject: [PATCH] docs: refresh published configuration references --- sources.json | 30 +- sources/app/README.md | 6 +- .../.github/assets/terminal/terminal-dark.svg | 33 +- .../assets/terminal/terminal-light.svg | 33 +- sources/cli/Documentation/Reference/CLI.md | 747 +++++++++++++++--- sources/cli/README.md | 106 ++- 6 files changed, 764 insertions(+), 191 deletions(-) diff --git a/sources.json b/sources.json index ba49232..baf3c7e 100644 --- a/sources.json +++ b/sources.json @@ -48,70 +48,70 @@ }, { "repository": "agents-tools/cli", - "revision": "60b93eeefe6a216afbd4d6ba450826adcf700425", + "revision": "1b387b1c978336066684ad4d1ada59df1201eed4", "path": "README.md", "file": "sources/cli/README.md", - "sha256": "9a817e71c889d29c3c09bd96a28f8e7ff302bb3879ad1b9c6f083cc0ad909540" + "sha256": "4818fc8b3f7d3e6de1bb6a90e9c01aade5455d15e735773a5f14fb0840ade237" }, { "repository": "agents-tools/cli", - "revision": "60b93eeefe6a216afbd4d6ba450826adcf700425", + "revision": "1b387b1c978336066684ad4d1ada59df1201eed4", "path": "Documentation/Reference/CLI.md", "file": "sources/cli/Documentation/Reference/CLI.md", - "sha256": "63450d387a021a239c363ae858d310ea730ab2de6847117df96ec5be0a949231" + "sha256": "b3c7526e55736b7963a0b2ca2e7a2df83e53d2db08f2f702371b79def2da5d0e" }, { "repository": "agents-tools/cli", - "revision": "60b93eeefe6a216afbd4d6ba450826adcf700425", + "revision": "1b387b1c978336066684ad4d1ada59df1201eed4", "path": ".github/assets/terminal/terminal-light.svg", "file": "sources/cli/.github/assets/terminal/terminal-light.svg", - "sha256": "48c6023cb8aa449d5df82f345dde942ddd3c2af03f7978add1bb6bc8886c7561" + "sha256": "206dc1f2f9e59f0de9f4f064977c3532956798ca81ce92707d1d5d42a1a738d1" }, { "repository": "agents-tools/cli", - "revision": "60b93eeefe6a216afbd4d6ba450826adcf700425", + "revision": "1b387b1c978336066684ad4d1ada59df1201eed4", "path": ".github/assets/terminal/terminal-dark.svg", "file": "sources/cli/.github/assets/terminal/terminal-dark.svg", - "sha256": "10d590cd834c59e385fccae7c6a4d2d22c4e0a096528a3b0f87ed37a79fd5a44" + "sha256": "94a73d605952fa9fa74499baa9a670feb0daec8b2f36512e2e1374ddbc75a232" }, { "repository": "agents-tools/cli", - "revision": "60b93eeefe6a216afbd4d6ba450826adcf700425", + "revision": "1b387b1c978336066684ad4d1ada59df1201eed4", "path": ".github/assets/logo/logo.png", "file": "sources/cli/.github/assets/logo/logo.png", "sha256": "58981839dd6ad3f2c1f5ed4273a64563d95f29925b210c338e76216238a73825" }, { "repository": "agents-tools/cli", - "revision": "60b93eeefe6a216afbd4d6ba450826adcf700425", + "revision": "1b387b1c978336066684ad4d1ada59df1201eed4", "path": ".github/assets/social-preview/social-preview.png", "file": "sources/cli/.github/assets/social-preview/social-preview.png", "sha256": "0070922e172068512e7c517a61fd0592110a9c786529fa66233502641ae260af" }, { "repository": "agents-tools/cli", - "revision": "60b93eeefe6a216afbd4d6ba450826adcf700425", + "revision": "1b387b1c978336066684ad4d1ada59df1201eed4", "path": "LICENSE", "file": "sources/cli/LICENSE", "sha256": "e5161d00bc83bb836971bd3db25271351663b8aa8928eb1b15b58f3c47ccdbeb" }, { "repository": "agents-tools/app", - "revision": "172a9a5435d1eaf2e114e4d6dd381295e543795a", + "revision": "08d88f89c9c6f36a357ad436729b19101ed04ee0", "path": "README.md", "file": "sources/app/README.md", - "sha256": "9d3dc02a307c677b65fda9affb550f015a247c06b7de7c102a23c87e4390fcff" + "sha256": "520f0290b416596c0c63d70afcacb787df146fda686e88b84ff66108b815409a" }, { "repository": "agents-tools/core", - "revision": "d4e5a4da09e044aa6526cdadd508bcf7a94309a1", + "revision": "ce6640adeb53ce0152134547938a6e13472e28b5", "path": ".github/assets/logo/logo.svg", "file": "sources/core/.github/assets/logo/logo.svg", "sha256": "9a1d4bed3e5e0a27b047ad7f4a61dd54436581c23014ff76e79acdd6dd93749e" }, { "repository": "agents-tools/core", - "revision": "d4e5a4da09e044aa6526cdadd508bcf7a94309a1", + "revision": "ce6640adeb53ce0152134547938a6e13472e28b5", "path": "LICENSE", "file": "sources/core/LICENSE", "sha256": "9ae2a33a73825aa7432d20210f675857c47987e6af792f9fc628797b8401f737" diff --git a/sources/app/README.md b/sources/app/README.md index 909c502..192b3ec 100644 --- a/sources/app/README.md +++ b/sources/app/README.md @@ -38,9 +38,7 @@ provides a SHA-256 checksum for the ZIP. ## Quick start 1. Open **Agents App** and select **User Configuration** in the scope picker to - work with user-level configuration. If you see **Import User Configuration**, - choose **Review Import…** to preview the sources, skills, and instructions - available from an existing `agents.json`. + work with user-level configuration. 2. For a project, open **Scope Actions**, choose **Add Project…**, and select the project directory. Pick that project in the scope picker to inspect and manage its configuration. The project list is stored in app preferences. @@ -69,7 +67,7 @@ provides a SHA-256 checksum for the ZIP. ## Development Open `Agents.xcodeproj` in Xcode 27 and select the `AgentsApp` scheme. The -project uses Swift 6, includes app, unit-test, and UI-test targets, and pins +project uses Swift 6, includes app and unit-test targets, and pins [Agents Core](https://github.com/agents-tools/core) to a full commit. That revision must be available for package resolution. Local Debug builds use ad hoc signing. diff --git a/sources/cli/.github/assets/terminal/terminal-dark.svg b/sources/cli/.github/assets/terminal/terminal-dark.svg index 2ce7326..03c5ee4 100644 --- a/sources/cli/.github/assets/terminal/terminal-dark.svg +++ b/sources/cli/.github/assets/terminal/terminal-dark.svg @@ -7,24 +7,24 @@ $ agents instructions add ~/team-rules code-review commits Added code-review, commits to AGENTS.md (claude-code, codex). $ agents watch add ~/team-rules -Watching local:~/team-rules from f4042e6. +Watching local:~/team-rules from 6fd753f. $ git -C ~/team-rules commit -qam "docs: review tests" $ agents watch -local:~/team-rules 1 commit since f4042e6 (now e21e12f) +local:~/team-rules 1 commit since 6fd753f (now da238b5) ~ changed code-review (instructions) 1 file $ agents update --apply -~ changed code-review (instructions) local:~/team-rules f4042e6 -> e21e12f -= repinned commits (instructions) local:~/team-rules f4042e6 -> e21e12f -= repinned pdf local:~/team-rules f4042e6 -> e21e12f +~ changed code-review (instructions) local:~/team-rules 6fd753f -> da238b5 += repinned commits (instructions) local:~/team-rules 6fd753f -> da238b5 += repinned pdf local:~/team-rules 6fd753f -> da238b5 = unchanged claude-code (link) .claude/skills/pdf = unchanged codex (link) .agents/skills/pdf AGENTS.md (claude-code, codex) --- a/AGENTS.md +++ b/AGENTS.md -@@ -2,7 +2,7 @@ +@@ -3,7 +3,7 @@ # Code review Check correctness. @@ -33,7 +33,7 @@ AGENTS.md (claude-code, codex) # Commits -Updated pdf for claude-code, codex: f4042e6 -> e21e12f. +Updated pdf for claude-code, codex: 6fd753f -> da238b5. Updated AGENTS.md. @@ -45,12 +45,13 @@ Updated AGENTS.md. - - + + + @@ -106,24 +107,24 @@ Updated AGENTS.md. - + - + - - - + + + - + @@ -132,6 +133,6 @@ Updated AGENTS.md. - + diff --git a/sources/cli/.github/assets/terminal/terminal-light.svg b/sources/cli/.github/assets/terminal/terminal-light.svg index f89df54..6c8d7a4 100644 --- a/sources/cli/.github/assets/terminal/terminal-light.svg +++ b/sources/cli/.github/assets/terminal/terminal-light.svg @@ -7,24 +7,24 @@ $ agents instructions add ~/team-rules code-review commits Added code-review, commits to AGENTS.md (claude-code, codex). $ agents watch add ~/team-rules -Watching local:~/team-rules from f4042e6. +Watching local:~/team-rules from 6fd753f. $ git -C ~/team-rules commit -qam "docs: review tests" $ agents watch -local:~/team-rules 1 commit since f4042e6 (now e21e12f) +local:~/team-rules 1 commit since 6fd753f (now da238b5) ~ changed code-review (instructions) 1 file $ agents update --apply -~ changed code-review (instructions) local:~/team-rules f4042e6 -> e21e12f -= repinned commits (instructions) local:~/team-rules f4042e6 -> e21e12f -= repinned pdf local:~/team-rules f4042e6 -> e21e12f +~ changed code-review (instructions) local:~/team-rules 6fd753f -> da238b5 += repinned commits (instructions) local:~/team-rules 6fd753f -> da238b5 += repinned pdf local:~/team-rules 6fd753f -> da238b5 = unchanged claude-code (link) .claude/skills/pdf = unchanged codex (link) .agents/skills/pdf AGENTS.md (claude-code, codex) --- a/AGENTS.md +++ b/AGENTS.md -@@ -2,7 +2,7 @@ +@@ -3,7 +3,7 @@ # Code review Check correctness. @@ -33,7 +33,7 @@ AGENTS.md (claude-code, codex) # Commits -Updated pdf for claude-code, codex: f4042e6 -> e21e12f. +Updated pdf for claude-code, codex: 6fd753f -> da238b5. Updated AGENTS.md. @@ -45,12 +45,13 @@ Updated AGENTS.md. - - + + + @@ -106,24 +107,24 @@ Updated AGENTS.md. - + - + - - - + + + - + @@ -132,6 +133,6 @@ Updated AGENTS.md. - + diff --git a/sources/cli/Documentation/Reference/CLI.md b/sources/cli/Documentation/Reference/CLI.md index 7625b13..1db688a 100644 --- a/sources/cli/Documentation/Reference/CLI.md +++ b/sources/cli/Documentation/Reference/CLI.md @@ -1,8 +1,10 @@ # CLI Reference -`agents` manages declared skills and instructions. Resolution, installation, +`agents` manages declared agent components. Resolution, installation, state, and recovery operations use `AgentsCore`, `AgentsSkills`, and -`AgentsInstructions`; top-level updates use `AgentsUpdates`. +`AgentsInstructions`. Combined lifecycle, content audit, component inspection, +import and MCP tests use `AgentsUpdates`. `AgentsManifest` owns declaration +parsing and editing, and the manifest dump contract. ## Commands @@ -12,11 +14,12 @@ agents skills list [source] [--json] agents skills remove agents skills update [names…] [--apply | --json] agents skills init [name] -agents instructions add [names…] [--replace] -agents instructions list [source] [--json] +agents instructions add [names…] [--replace] +agents instructions list [source|.] [--json] agents instructions remove -agents instructions update [--apply | --json] +agents instructions update [--apply [--replace] | --json] agents instructions render chatgpt +agents instructions export [--root …] [--json] agents instructions init agents watch agents watch add [--path ] [requirement options] [--scope project|user] @@ -24,19 +27,69 @@ agents watch status [--json] [--scope project|user] agents watch diff [name] [--kind skill|instructions|artifact] [--json] [--scope project|user] agents watch seen [--revision ] [--scope project|user] agents watch remove [--scope project|user] -agents install [--json] -agents update [--apply | --json] -agents doctor [--root …] [--json] +agents components inventory [--scope project|user] +agents components list [ --group --alias ] [--json] [--scope project|user] +agents components add --group [--alias ] [--binding NAME=ENV_VAR] [--scope project|user] +agents components remove [--kind ] [--identity ] [--occurrence ] [--agent ] [--binding NAME=ENV_VAR] [--scope project|user] +agents import --format [--root ] [--select ] [--apply | --json] [--binding NAME=ENV_VAR] [--scope project|user] +agents bundle init --name --package-version +agents bundle pack [--output | --publish-to ] [--reviewed-digest ] +agents bundle plugin --target [--marketplace ] [--category ] [--output ] [--reviewed-digest ] +agents bundle export --name --package-version --component … [--dependency ]… [--scope ] +agents bundle inspect +agents bundle import --agent … [--component ] [--scope ] [--json | --apply] +agents auth check --source [--scope project|user] [--validate] [--json] +agents auth check --host [--json] +agents auth export --source [--scope project|user] +agents cache info [--json] +agents cache clean [--apply] [--json] +agents cache prune [--days ] [--apply] [--json] +agents marketplace publish (--directory | --catalog ) [--summary ] [--scope ] +agents marketplace stage --directory [--summary ] +agents marketplace register (--directory | --index | --git [--ref ] [--subpath ]) [--scope ] +agents marketplace list [--scope ] +agents marketplace unregister [--scope ] +agents marketplace search [] [--scope ] +agents marketplace verify [--scope ] +agents marketplace resolve [ [] [--alias ]] [--json] [--scope ] +agents marketplace install (--agent … [--component … | --member …] | --metadata-only) [] [--alias ] [--replace] [--binding NAME=ENV_VAR] [--lock-only] [--json | --apply] [--scope ] +agents marketplace lock [--scope ] [--json | --apply] +agents marketplace deploy [--scope ] [--replace] [--binding NAME=ENV_VAR] [--json | --apply] +agents marketplace installed [--scope ] +agents marketplace deps [--scope ] +agents marketplace why [--scope ] +agents marketplace outdated [] [--scope ] +agents marketplace upgrade [] [--agent … --member …] [--binding NAME=ENV_VAR] [--scope ] [--lock-only] [--json | --apply] +agents marketplace remove [--binding NAME=ENV_VAR] [--scope ] [--lock-only] [--json | --apply] +agents mcp search [] [--registry ] [--limit ] [--cursor ] [--all-versions] [--json] +agents mcp show [--server-version ] [--registry ] [--json] +agents mcp add --name --agent [--choice ] [--server-version ] [--input INPUT=ENV_VAR] [--scope project|user] [--apply] +agents mcp test [--kind mcpServer] [--identity ] [--occurrence ] [--binding NAME=ENV_VAR] [--json] [--scope project|user] +agents manifest dump --json [--scope project|user] +agents lifecycle list [--scope project|user] [--json] +agents lifecycle validate [--scope project|user] [--json] +agents lifecycle init [--scope project|user] [--force] [--apply [--reviewed-digest [--reviewed-original-digest ]]] [--json] +agents lifecycle test [] [--scope project|user] [--execute] [--json] +agents lifecycle trust [--apply [--reviewed-digest --reviewed-root --reviewed-revision ]] [--json] +agents lifecycle trusted [--json] +agents lifecycle untrust [ | --root-id ] [--json] +agents install [--json] [--binding NAME=ENV_VAR] +agents update [--apply | --json] [--binding NAME=ENV_VAR] [--replace] [--changing-access] +agents doctor [--root …] [--ci] [--require-organization-policy] [--json] +agents export-patch [--scope project|user] [--dry-run] [-o ] [--json] +agents audit [--scope project|user] [--file | --agent …] [--ci] [--format markdown|json|sarif] +agents audit --file --strip [--scope project|user] [--apply] ``` `agents --help`, `agents skills --help`, `agents instructions --help`, -`agents watch --help`, and each command's `--help` describe their options. +`agents watch --help`, `agents manifest --help`, `agents auth --help`, and each +command's `--help` describe their options. Running a group without a subcommand prints help, except `agents watch`, which runs `watch status` and accepts its options. `agents --version` prints `agents X.Y.Z` and is available only on the root command; the version constant lives in `Sources/CLI/EntryPoint.swift`. -Root overview: "Manage agent skills and instructions from declared sources." +Root overview: "Manage agent components from declared sources." Root help includes: ```text @@ -54,19 +107,20 @@ Examples: | Option | Meaning | Commands | | --- | --- | --- | -| `--scope project\|user` | Where state lives: project (./.agent) or user (~/.agents). Default: project. | All lifecycle and read commands; `init` uses the current directory | -| `--agent ` | Agent to install for: codex, claude-code, cursor, gemini-cli or opencode. Repeat for several. Default: the agents already recorded for this skill or source, else the declaration's agents, else codex and claude-code. | `skills add` | -| `--agent ` | Limit to this agent: codex, claude-code, cursor, gemini-cli or opencode. Repeat for several. Default: all recipients. | `skills list`, `skills remove`, `doctor` | -| `--agent ` | Set the scope's entire instruction section list recipients. Repeat for several. Default: recorded instruction agents, else declaration agents, else codex and claude-code. | `instructions add`, `instructions remove`, `instructions update` | +| `--scope project\|user` | Where state lives: project (./.agent) or user (~/.agents). Default: project. | Commands with a scope option. Lifecycle trust commands use the current project or the user trust store. | +| `--agent ` | Agent to install for: codex, claude-code, cursor, gemini-cli, opencode, or antigravity. Repeat for several. Default: the agents already recorded for this skill or source, else the declaration's agents, else codex and claude-code. | `skills add` | +| `--agent ` | Limit to this agent: codex, claude-code, cursor, gemini-cli, opencode, or antigravity. Repeat for several. Default: all recipients. | `skills list`, `skills remove`, `doctor` | +| `--agent ` | Select instruction recipients. `add` can select Antigravity rules for specific sections. `remove` and `update` set the scope's instruction recipient list. Repeat for several. | `instructions add`, `instructions remove`, `instructions update` | | `--path ` | Search this subdirectory of the source. | Both kinds' `add` and `list `, `watch add` | | `--full-depth` | Discover recursively beyond conventional skill directories | `skills add`, `skills list ` | | `--mode link\|copy\|edit` | How to install: link (default), copy, or edit (a live link to a local source). | `skills add` | -| `--root …` | Audit these project directories read-only. Repeat for several. | `doctor` | -| `--json` | Emit a versioned JSON report on stdout | Both kinds' `list`, `install`, `doctor`, all update previews, `watch status`, `watch diff` | +| `--root …` | Audit or map these project directories read-only. Repeat for several. | `doctor`, `instructions export` | +| `--replace` | Take over target files that agents did not generate. | `instructions add`, `instructions update --apply` | +| `--json` | Emit a versioned JSON report on stdout | Both kinds' `list`, `install`, `doctor`, all update previews, `instructions export`, `watch status`, `watch diff`, `auth check`. `manifest dump` requires it. | -Agents are `codex`, `claude-code`, `cursor`, `gemini-cli`, and `opencode`. -For instruction recipients, Cursor supports project scope only. ChatGPT is a -named render target, not a `--agent` value. Core also accepts `claude` and +Skill and instruction recipients are `codex`, `claude-code`, `cursor`, +`gemini-cli`, `opencode`, and `antigravity`. Cursor instructions use +project scope. ChatGPT is a named render target. Core also accepts `claude` and `gemini` as input aliases. Output uses canonical IDs. On skill add, omitted recipients use the agents already recorded for the skill or source, then declaration defaults (initially Codex and Claude Code). On skill list, skill @@ -86,6 +140,57 @@ the lock. Top-level update and install accept no recipient or mode override. change directory for project operations or use doctor's `--root` for auditing. Unsupported options are usage errors. +## Package Lifecycle Actions + +`lifecycle list` shows action sources, events, order and eligibility. +`lifecycle validate` reports declaration diagnostics with their source and +field. Both are read-only. Project scope includes administrator, user and +current project sources. User scope includes administrator and user sources. + +`lifecycle init` reviews starter events in an existing `agents.yaml` for the +selected scope. Pass `--apply` to save them and `--force` to replace an existing +lifecycle block. For a separate review, pass its document digest with +`--reviewed-digest`. A reviewed replacement also requires the preview's +`originalDigest` as `--reviewed-original-digest`. A scaffold save grants no trust. + +Project actions require trust for their exact lifecycle declaration and +physical project root. Run `lifecycle trust` to review the authored actions, +then `lifecycle trust --apply` to confirm at a terminal. For noninteractive +approval, pass the review's `digest`, `rootID` and `revision` as +`--reviewed-digest`, `--reviewed-root` and `--reviewed-revision`. Shell actions +run with your access and can invoke mutable checkout files outside the digest. +`lifecycle trusted` lists stored grants, including absent paths. Revoke any +grant with `lifecycle untrust --root-id `, or use its path when unique. + +`lifecycle test` simulates `post-install` by default. Select any event shown +below. `--execute` runs eligible actions from that review and waits for their +results. A failed or withheld explicit execution exits nonzero. Validation +errors also exit nonzero. `APM_NO_SCRIPTS=1` withholds action starts. + +| Package operation | Events | +| --- | --- | +| `install`, applied bundle import and marketplace install or deploy | `pre-install`, `post-install` | +| Applied `update`, `skills update`, `marketplace upgrade`, `marketplace lock` | `pre-update`, `post-update` | +| `skills remove`, `instructions remove`, `components remove`, applied `marketplace remove` | `pre-uninstall`, `post-uninstall` | +| Applied `instructions update` | `pre-compile` | + +A marketplace operation with `--lock-only` uses that command's own events. +Previews, inspection and exports run no actions. A package operation +reports action failures as advisory results and uses its package outcome for +the exit status. A failed package apply reports which actions already started. +Recovery before a review can retry preparation. A submitted review has one +attempt. + +Lifecycle JSON reports carry `schemaVersion: 1` and a `kind` for the command. +Action entries use zero-based indices within each source event. Execution +results report dispatch, disposition and applicable exit, signal, HTTP or +withholding details. Inspection and execution summaries show the shell or +HTTPS origin, and the project trust review displays the authored declaration. +`install --json` includes an optional `lifecycle` object with `pre`, `post`, +`diagnostics` and the package `disposition`. The report marks interruption +or pending recovery when applicable. Review notices go to stderr when a JSON +command writes or executes. + ## Adding and Inspecting Skills `source` is a local path, Git URL or shorthand accepted by core, well-known @@ -103,16 +208,17 @@ is a usage error. Both require a Git repository for local sources and read committed content. `edit` links live local directories and accepts no requirement. -Requirement options on add map directly to declaration forms: +Requirement options on add populate a source's `requirement` mapping in +`agents.yaml`: | Option | Declaration | Matching versions | | --- | --- | --- | -| `--branch main` | `"branch": "main"` | Git branch | -| `--revision ` | `"revision": ""` | Git revision | -| `--exact 1.2.3` | `"exact": "1.2.3"` | Exact semantic version | -| `--from 1.2.3` | `"from": "1.2.3"` | At least 1.2.3, below 2.0.0 | -| `--up-to-next-minor-from 1.2.3` | `"upToNextMinor": "1.2.3"` | At least 1.2.3, below 1.3.0 | -| `--from 1.2.3 --to 1.8.0` | `"from": "1.2.3", "to": "1.8.0"` | Half-open range [1.2.3, 1.8.0) | +| `--branch main` | `requirement: {branch: main}` | Git branch | +| `--revision ` | `requirement: {revision: ""}` | Git revision | +| `--exact 1.2.3` | `requirement: {exact: "1.2.3"}` | Exact semantic version | +| `--from 1.2.3` | `requirement: {from: "1.2.3"}` | At least 1.2.3, below 2.0.0 | +| `--up-to-next-minor-from 1.2.3` | `requirement: {upToNextMinor: "1.2.3"}` | At least 1.2.3, below 1.3.0 | +| `--from 1.2.3 --to 1.8.0` | `requirement: {from: "1.2.3", to: "1.8.0"}` | Half-open range [1.2.3, 1.8.0) | Choose one requirement form; `--to` requires `--from`. With no requirement, core uses the latest version tag or the default branch if there are no tags. @@ -136,7 +242,7 @@ an `@` followed by one of these labels and `:`, so SSH locations such as `agents skills add larksuite/cli lark-base --from 1.0.0`. Use at most one requirement selector, one `@path:`, and one `@skill:`; percent-encode an `@` inside a value as `%40`. A selector and an option that give the same field must -agree; both replace the branch and path of a hosted tree URL. `agents.json` +agree; both replace the branch and path of a hosted tree URL. `agents.yaml` stores the structured fields, and the alias comes from the location. `instructions add` and `watch add` accept requirement and path selectors; `@skill:` applies to `skills add` and `skills list `. @@ -153,54 +259,94 @@ identifiers; use the source ID and skill name for identity. ## Instructions Instruction sources are Git URLs, shorthands, local Git roots, or existing -source aliases. Discovery reads committed `*.md` files directly inside -`instructions/` and `.agents/instructions/`, relative to the source root or -`--path` subdirectory. Local paths must identify the Git root. Instruction add -supports the same requirement options as skill add; instructions do not have -installation modes, recursive discovery, or `--all`. +source aliases. Discovery reads committed `*.md` files, including those in +subdirectories, inside `instructions/` and `.agents/instructions/`, relative to +the source root or `--path` subdirectory. A file's name is its +container-relative path without `.md`, such as `epd/review`. Local paths must +identify the Git root. Instruction add supports the same requirement options as +skill add; instructions do not have installation modes or `--all`. The source +`.` is the project's own `.agent/instructions/`: its files are read from the +working tree, referenced by bare name, and locked by hash. + +Each instructions file starts with front matter holding a required +`description` and optional `paths`, a list of glob patterns using `*`, `**` +and `?`. The body starts with one heading at any level, and every other heading +in it is deeper. `instructions init ` creates +`.agent/instructions/.md` with this skeleton in the current project and +rejects an existing file. `instructions add [names…]` appends sections in argument order to the -scope's ordered list. With no names, one available section is added; several -available sections are listed for selection without writing declarations or -locks. `instructions list ` lists available sections; -`instructions list` reports locked sections, physical targets and named prompts, -including missing targets. Doctor reports their disk status. - -Core writes one managed block per physical target and preserves custom content -around it. The block and its adjacent separating blank lines belong to core; -removing the block also removes those separators. Project Codex, Claude Code, -Cursor, and OpenCode share `AGENTS.md`; -Gemini CLI uses `GEMINI.md`. User targets are the corresponding agent files -under their configuration directories. Headings shift below an existing title. -When a project Claude file exists, core adds a managed import of `AGENTS.md` -where needed. Existing forwarding and custom content are preserved. - -Conflicting custom sections stop add with differences in the diagnostic. -`--replace` displays a unified target diff before replacing conflicts. -`instructions remove ` removes sections from file targets and ChatGPT -prompts. Use `source-alias:name` if a bare name is ambiguous. Empty managed -blocks are removed; files created by core are deleted only when no custom -content remains. `instructions init ` creates `.md` in the current -directory and rejects an existing file. - -Declare named ChatGPT prompts in the scope's `agents.json`, using an existing +scope's ordered list. In a legacy single-list configuration, `--agent` sets +the list's recipients. With no names, one available section is added. When +several are available, `add` lists them for selection without writing declarations +or locks. `instructions list ` lists available sections with their +headings and descriptions. `instructions list` reports locked sections, +physical targets and named prompts, including missing targets. Doctor reports +their disk status. + +Core generates each legacy target in full with a notice line followed by the +sections in declared order. Project Codex, Claude Code, Cursor, and OpenCode +share `AGENTS.md`; Gemini CLI uses `GEMINI.md`. User targets are the +corresponding agent files under their configuration directories. A section +with `paths` gets an `Applies when working on files matching …` line after its +first heading; in project scope it goes to the target in the directory its +patterns share, which must exist. When a project Claude file exists, core adds +a managed import of `AGENTS.md` where needed. A local link must resolve to a +file in the project being written. User targets accept no local links. + +Antigravity and `agy` read one managed Markdown file per selected section. +Project rules live in `.agents/rules/` and user rules in `~/.gemini/config/rules/`. +Each file has `trigger: always_on` front matter. The rendered file, including +expanded references and front matter, can be at most 24,000 UTF-8 bytes. Core +reports the rule and size when that limit is exceeded. The preview also shows +the shared 20,000-token budget advisory for active global and always-on rules. +`agents instructions add team review --scope user --agent antigravity` +installs `review` as an Antigravity rule and preserves other sections' recipient +assignments. In `agents.yaml`, a section's `condition.agents` narrows the +instruction component's recipient list for that section. `agents install --scope user` +restores the locked selections. Core +migrates a Memex rule whose source path, revision, and bytes match. The preview +reports conflicts when a rule differs or unmanaged content occupies the destination. + +A legacy target is generated when its first line is the notice. Edits below the +notice are drift, which update and `install` replace. Any other file in a legacy target +location, unless blank, stops `add`, `update --apply`, `remove` and `install`, +even when the lock records it; move what it needs into instructions files, then +`--replace` on `add` or `update --apply` shows its diff and takes it over. For +`install` and `remove`, move the file aside and retry, then put what it needs +into instructions files. `instructions remove ` removes sections from file targets and +ChatGPT prompts. Use `source-alias:name` if a bare name is ambiguous. A target +left without sections is deleted while it matches its locked rendering; an +edited one stays in place and leaves the lock. + +`instructions export [--root …]` maps each locked target to the sections +it receives, reading the user scope and then each project root (default: the +current directory) without writing. A scope without a lock, with pending +recovery, or with unreadable state is reported with that status. A project +section is placed from its `paths`, so one whose content is not available +locally, an own file changed since the lock or a source section missing from +the cache, is listed as unplaced; `agents install` fills the cache. + +Declare named ChatGPT prompts in the scope's `agents.yaml`, using an existing source alias (here `rules`): -```json -{ - "instructions": { - "sections": ["rules:canonical-artifacts"], - "chatgpt": { - "weekly": { - "sections": ["rules:canonical-artifacts"], - "append": "prompt-custom.md" - } - } - } -} +```yaml +version: 1 +sources: + rules: + path: ../team-rules +components: + - kind: instructions + sections: + - {name: canonical-artifacts, source: rules} + chatgpt: + weekly: + sections: + - {name: canonical-artifacts, source: rules} + append: prompt-custom.md ``` -Merge this fragment with the declaration's existing sources and selections. +Add the named prompt to the instructions component's `chatgpt` mapping. `append` is optional and relative to the project root or HOME for user scope. Run `agents instructions update` to preview, then `--apply` to lock the prompt. `agents instructions render chatgpt weekly` writes the locked sections in @@ -214,6 +360,254 @@ removed prompts must be cleared in ChatGPT. Core detects changes to section bytes, membership, order, or append path. Edits to the append file's contents are read at render time and are not tracked as prompt changes. +## Manifest + +`manifest dump --json [--scope project|user]` reads the selected scope's existing +`agents.yaml` under a shared lock and prints core's encoded manifest JSON bytes. +`--json` is required. The project root is the current directory; change directory +to select another project. No `--path`, source argument or `--root` is accepted. + +Dump parses the local YAML document without resolving external groups, fetching +sources or secrets, inspecting native files, or starting configured programs. +Conditions and group references remain symbolic. It never creates state, replays +recovery or writes the declaration. A missing file, pending recovery, or invalid +manifest fails with exit 1 and empty stdout. YAML syntax, schema and domain +failures include path, line, UTF-8 byte column, severity and stable diagnostic +code on stderr; related locations follow when available. Invalid +arguments exit 64. See the [dump contract](ManifestDump.md) for encoding and +schema ownership. + +## Components + +Use `agents components inventory > inventory.cdx.json` to export the current project's +locked components as CycloneDX 1.6 JSON. Use `--format spdx` for SPDX 2.3. Set `SOURCE_DATE_EPOCH` to the build timestamp for reproducible output. Pass `--scope user` for user configuration. +Each source lists its locked version or revision and the components it provides. +Each component records its kind and target clients. The inventory reads committed +state and reports pending recovery before emitting a document. + +`components list` inspects the committed scope without resolving sources, +reading bindings or running recovery. `--json` includes exact logical identities, +inspection generations and occurrence IDs. A pending transaction fails rather +than recovering. A missing scope lists no components and creates no state. + +`components list --group ` discovers a canonical exported group +without installing it. A source can be an existing alias; a new path or repository +requires `--alias `. `--path` and the existing source requirement flags +select the source root and revision. Discovery resolves sources in Core’s +borrowed source session; it does not deploy components, resolve runtime bindings +or start programs. The returned graph includes existing scope intent as well as +the selected group. + +`components add` accepts the same source/group options and applies that canonical +group use. Source aliases must be distinct. `components remove ` removes a +managed component through Core’s exact selection API. Duplicate names require +`--kind`, `--identity` or an exact `--occurrence`; the command never chooses the first match. +`--occurrence` selects one listed authored occurrence; without it, the logical +component selection applies. `--agent` limits recipient removal. Core rejects +stale selections and protects unrelated domains and authored bytes. + +Top-level update, component add/remove and import support `--replace` for Core’s +explicit conflict takeover and `--changing-access` for its reported owner-only +permission changes. These options are passed to Core’s prepared request; Core +continues to decide ownership and safety. Install restores existing locked intent. + +Native component update previews print changed or unchanged component rows, +symbolic before/after content, required binding names and permission changes. +Completion lines identify the component and target after a successful apply. + +## Import + +`import --format [--root ]` previews one explicit +producer document. The document is relative to root (cwd by default); Core +validates path containment and the profile. `--select` may be repeated for +profile-defined member selection. Profiles include `codexConfigV1`, +`claudeSettingsV1`, `cursorMCPV1`, `claudeCommandV1`, `geminiCommandV1`, +`openCodeCommandV2`, `rulesyncSourcesV1`, `apmManifest` and `apmLock`. +Core owns supported profile names and conversion rules. + +The default human report and `--json` describe source claims, converted component +kinds, resources, unresolved bindings and conversion diagnostics. This is an +import inspection, not an installed-state or deployment-success report. Preview +reads only the explicit producer inputs and does not write the scope or resolve +bindings. `--apply` captures the current scope, merges converted canonical intent +and uses the normal prepared transaction. Unresolved conversion diagnostics, +bindings, source alias conflicts or stale captured inputs prevent application. +Native producer deployment claims do not grant ownership of existing targets. +A separate apply invocation rereads the producer document. `--json --apply` is a +usage error. + +## Package Source Credentials + +`agents auth check --source ` uses the same selector as installation. +It reads the declaration and effective source policy for the selected scope, +which defaults to `project`. The report describes the provider, effective host +and port, transport, credential source category, and availability. An archive +route reports the mirror's host and uses the mirror's credential binding. +`agents auth check --host ` inspects host-wide bindings only, +with port 443 by default. `--scope` applies to selection by `--source`. +Core's trusted runtime configuration supplies provider registrations, mirrors, +and credential bindings. Project declarations select sources. + +Default inspection makes zero network requests and leaves credential resolution +to the operations that use it. SSH reports `ssh-managed` and delegated Git +authentication reports `delegated/unverified`. With `--source`, `--validate` +explicitly requests a check at the binding's authorized provider identity +endpoint, subject to current egress policy. Validation reports `accepted`, +`refused`, or `indeterminate`. Reports omit credentials, response bodies, and +subprocess diagnostics. A remote source with no available credential or an explicitly +refused credential produces its report and exits 1. An inconclusive provider check +with an available credential exits 0. With `--json`, the `validation` property is omitted when +validation was skipped. + +`agents auth export --source ` writes one explicitly exportable +credential to pipe-backed stdout, including shell command substitution. It uses +the same scoped selector and source policy. Core refuses ambiguous or opaque +bindings, terminals, and file redirection. Export has no JSON mode and stores +nothing. The pipe recipient is responsible for how it handles the value. + +## Download Cache + +Use `agents cache info` to see the cache location, store sizes and entry counts. +`agents cache clean` previews all disposable downloads. `agents cache prune +--days 30` previews Git revisions last used more than 30 days ago. Set +`--days 0` to review all earlier Git entries. Add `--apply` to remove eligible +entries or use its aliases `--force` and `--yes`. Each invocation checks the +current inventory. A changed or busy entry can survive cleanup. The result +lists skipped entries, failures and actual reclaimed bytes. Partial failure +returns a nonzero status and leaves completed removals in place. + +The user cache is shared across projects. Set `AGENTS_CACHE_DIR` to select its +root. Frozen deployment state and its required recovery contents stay with +the owning scope. + +## Bundles and Marketplaces + +Choose a local directory with `--directory `, a Git repository with +`--git `, or a hosted HTTPS index with `--index `. +Use `marketplace register ` with the address to save it. Search and +install accept the same address or a saved `--catalog `. Git sources +also accept `--ref` and `--subpath`. Use `marketplace stage --directory +` to add a bundle to a static hosting directory. The command prints the +index path. Deploy that directory with your hosting service. Project registrations take precedence over +user registrations of the same name. A relative registration is resolved +against its declaring scope. Installing records the catalog origin, so +changing a registration does not redirect an installed root. + +For a private hosted marketplace, register its index with `--scope user`. Bind a +token for the current command with `--token-env team=TEAM_MARKET_TOKEN`, where +`team` names that user registration. Resolving an index by another name still +uses its exact URL to select the credential. Repeat the option for dependencies +from other private indexes. For archive redirects to a trusted CDN, pass +`--download-origin https://cdn.example.com`. The CDN receives no market token. + +Run `agents bundle init` to scaffold a package. In that directory, select first-party instructions, complete skill directories, MCP servers or locked members in `author-package.json`. Run `agents bundle pack` to review the members, paths, findings and digest. Pass `--output` to write a portable archive. To publish the reviewed version, repeat the command with `--publish-to` and `--reviewed-digest`. A changed input requires a fresh review. Use `agents bundle plugin` to inspect a client-native distribution and `--output` to write it. For a Codex marketplace, supply both `--marketplace ` and `--category `. Plugin exports take the author and description from the project specification. + +Use `agents export-patch --dry-run --json` to review edits to deployed copies. +Each patch identifies its producer, base and affected paths and includes the exact +patch text. The review lists any skipped files with their reasons. Run +`agents export-patch -o ` to write the patches. The default output is +`patches/` in the current project. Identical files can be reused. A conflicting +file is preserved and the command reports a partial export with a failing status. + +Use `bundle export` with an identity from `components list --json` for each +member. Repeat `--dependency '[CATALOG:]PACKAGE@REQUIREMENT'` to declare the +package's edges. An unqualified edge uses the catalog that publishes the +bundle. A qualified edge records the registered Git repository or the canonical HTTPS index URL. +`bundle inspect` lists the dependencies and selectable entry IDs. Publish a +dependency-bearing archive to a catalog and install it through +`marketplace install`. `bundle import` applies an archive directly and +requires a self-contained bundle. + +`--package-version ` chooses an exact release. `--requirement` takes +an exact version, `major:1.2.0` (up to the next major), +`minor:1.2.0` (up to the next minor), or a half-open range such as +`'1.2.0..<2.0.0'`. Without a constraint, a new install selects the latest +release. A graph upgrade keeps the root's constraint and recipients unless +you explicitly replace them. Use `--requirement` to change the constraint or +`--package-version` to pin an exact release. Exact leaf installs made without +graph options retain their existing upgrade behavior and can advance to the +newest release by default. + +Use `agents marketplace lock` to resolve the package roots already in the declaration. Add `--apply` to save the frozen graph for later deployment. + +Use `--lock-only` with marketplace install, upgrade or remove to review the exact releases and target selections for a later deployment. Add `--apply` to save that pending lock. Existing deployed files stay in place. Run `agents marketplace deploy` to preview native changes from the frozen resources, then add `--apply` to deploy them. + +Use `marketplace resolve` for read-only discovery. With no arguments it +resolves the scope's declared graph roots. Supply a package and catalog to +discover a prospective root. The result lists dependencies, available +members, the locked version, the selected eligible version and the highest +published version. The latest release can be outside the graph's constraints. +`marketplace outdated ` uses upgrade preferences to show +eligible changes for an installed root. `marketplace deps` and +`marketplace why ` read committed state without opening catalogs. + +With `--agent`, installation selects all members of the root release by +default. Repeat `--component` to select its entry IDs or repeat `--member` to +select logical members of the root or its dependencies. A member has the +form `[CATALOG:]PACKAGE/KIND/NAME`, where kind is `skills`, `instructions` or +`mcpServer`. Unqualified members use the root's catalog. Every named agent +receives the selected members. On upgrade, an explicit member list replaces +the root's selections. A dependency can be resolved with no selected native +members. `--metadata-only` installs a root with an empty selection. On an +existing root this previews removal of that root's current selections. + +`marketplace install`, `upgrade` and `remove` preview by default. With +`--apply` they recheck the preview and commit the graph and its native +deployments together. Use `--binding NAME=ENV_VAR` for selected components that +need runtime values. On install, `--replace` offers to replace conflicting +instruction content in the preview. Removing one root keeps versions and +recipients still required by another root. Top-level `agents install` +restores the committed packages without rediscovering catalog releases. + +```sh +agents marketplace resolve onboarding --catalog team --requirement 'major:1.0.0' +agents marketplace install onboarding --catalog team --requirement 'major:1.0.0' \ + --agent codex --member onboarding/mcpServer/handbook --member shared/skills/review +agents marketplace why shared +agents marketplace upgrade onboarding --apply +``` + +## MCP Registry + +Use `mcp search` to browse the registry, then `mcp show` to inspect an exact version, +its numbered installation choices and input requirements. Set `MCP_REGISTRY_URL` to use a team +registry by default. The public registry is the default when the variable is unset. Pass +`--registry ` to override the endpoint for one command and `--token-env ` +when it requires bearer authentication. +The token is read for the registry request. Search and inspection leave the selected scope unchanged. + +Use `mcp add` to preview installation under the chosen name for one or more `--agent` recipients. +Pass the same `--server-version` and `--choice` that you inspected. A server with a single +choice selects it by default. Map requested inputs with `--input INPUT=ENV_VAR`. +Apply the configuration with `--apply`. Native private materialization uses the ordinary +`--binding` and `--changing-access` options when the preview identifies that need. + +## Runtime Bindings and MCP Tests + +`install`, top-level `update`, component add/remove, `import` and `mcp test` +accept repeated `--binding NAME=ENV_VAR`. The mapping names the only environment +variable that may supply that symbolic secret binding. At most 256 distinct +mappings are accepted; each mapping is at most 4096 UTF-8 bytes and each requested +value at most 1 MiB. Missing or invalid values identify only the symbolic binding. +No command is evaluated and no credential store or other client configuration is +read. Mapping validation does not read values. Only Core’s actual provider call +during apply or an explicit MCP test reads the named variable; previews, list, +doctor and help do not resolve it. Native `{env: NAME}` bindings remain Core’s +ordinary runtime environment references. + +`mcp test ` selects one managed MCP server using the same exact identity +and occurrence options as component removal. It captures Core’s selected typed +snapshot before testing, without refreshing sources or parsing native client +configuration. This explicit command can start its displayed stdio process or +contact its configured HTTP/SSE endpoint. It initializes the MCP protocol and +discovers tools; it does not apply configuration or change the scope ledger. +The JSON result contains transport, outcome, issue code, protocol version, +redacted tool metadata, elapsed time and cleanup status. Human output contains +outcome and redacted tool names. Successful discovery or a handshake with no tools +exits 0; incomplete/failed tests or incomplete cleanup exit 1. Core owns timeout, +redaction and owned process/resource cleanup. This result describes the explicit +test, independently of a native client’s authentication, trust and tool permissions. + ## Watch `watch add ` subscribes without installing content and records the @@ -289,7 +683,7 @@ baselines, installations, or source working trees. Uncommitted source files are ignored. Scheduling checks is left to the caller. Watch baselines live in `.agent/agents.watch` for project scope or -`~/.agents/agents.watch` for user scope. `agents.json` owns subscriptions. +`~/.agents/agents.watch` for user scope. `agents.yaml` owns subscriptions. A missing subscription suggests `run 'agents watch' to list subscriptions`; an invalid revision suggests providing a Git revision that resolves to a commit in the watched source. Operation failures exit 1; invalid options and unknown @@ -432,9 +826,9 @@ This reports unrecorded membership, not absent files. An existing live link can produce no physical diff, but applying still rejects an entry the scope does not manage. Preview does not grant ownership of existing files. -`agents update --apply` prepares skills and instructions under one writer lock, +`agents update --apply` prepares all components under one writer lock, prints the combined report once, and applies that exact preparation in one -transaction. Both kinds and their merged state commit together. It prints +transaction. All selected kinds and their merged state commit together. It prints completion lines only after the combined operation returns successfully. Recovery retries the entire preparation and displays its fresh report. `No changes.` uses core's combined `hasChanges`, which also covers state-only @@ -448,9 +842,9 @@ Updated recipients were installed before and remain installed; added recipients have new membership. Agent lists are comma-separated and sorted by agent ID. Pins use the same version and seven-character revision format as previews. When both pins are unavailable, the update line is `Updated for .` -Unchanged skills print no completion. Instruction target -completions print `Updated .` Changed ChatGPT prompts are named for -re-pasting after a combined apply. There is no generic success banner. +Unchanged skills print no completion. Instruction target completions describe +the file action as `Created .`, `Updated .`, or `Removed .` +Changed ChatGPT prompts are named for re-pasting after a combined apply. A preview can become stale; a separate `--apply` invocation prepares again and displays the content it will actually write. `--json --apply` is a usage error. @@ -461,17 +855,22 @@ Installed pdf for claude-code, codex (link). Added code-review, commits to AGENTS.md (claude-code, codex). Updated pdf for claude-code, codex: 6c09c94 -> 9661957. Updated AGENTS.md. -Removed commits from AGENTS.md. +Removed ~/.gemini/config/rules/example.md. Removed pdf for claude-code, codex. ``` -Normal instruction adds print only the completion lines. Replacing conflicting -custom sections with `--replace` prints the conflict diff first. Instruction -removal prints target diffs before its completion lines. +Normal instruction adds print only the completion lines. Taking over a file +with `--replace` first prints `Take over , which agents did not generate` +and its diff. Instruction removal prints target diffs before its completion +lines, and `Left in place because it differs from its generated version` +for an edited target it keeps. -`install` restores skills, then instruction targets, using exact locked pins, -hashes, modes, recipients, and heading offsets. It does not resolve newer versions and takes no source argument. Unavailable pins or content -that fails digest verification cause failure. +`install` restores all components in one transaction, using exact locked pins, +hashes, modes, and recipients. It does not resolve newer versions and takes no +source argument. Unavailable pins and content that fails digest verification cause +failure. Own instructions are restored from their locked content; edits to their +source files remain untouched and doctor reports them as changed. Run +`agents instructions update --apply` to adopt those edits into the lock and targets. `skills remove` requires names and removes their declarations, files, and lock entries. With `--agent`, it removes only those recipients. Removing a member of an `all` @@ -480,12 +879,12 @@ selection records an exclusion so an update does not reinstall it. `skills init [name]` creates a skill directory and `SKILL.md` in the current directory; without a name it creates `SKILL.md` directly there. Existing files are errors. -Top-level install runs one core operation per kind, in order. Each kind commits -its own transaction; an instruction install failure does not roll back a -completed skill install. Its recovery retry is scoped to the failing operation. +Top-level install uses Core’s single restore operation. Preparation failure leaves +all domains unchanged, and completion or successful JSON is emitted only after +the entire restore succeeds. Recovery retries the whole restore. A failed combined update exits 1 and prints no completion or successful JSON -report. Preparation errors leave both kinds unchanged. Apply errors report +report. Preparation errors leave all selected kinds unchanged. Apply errors report core's confirmed outcome: no update applied, committed with a later failure, or recovery required. A committed outcome calls for inspection with `agents doctor` in the same scope; recovery requires an applying operation in the same scope. @@ -493,12 +892,16 @@ Concurrent external edits can invalidate a preparation and remain untouched. ## Doctor and State -Doctor reports skills first, then instructions for each root. Skill checks +Doctor reports skills, instructions and other managed component deployments for each root. +Component checks use Core’s read-only inventory, report missing, drifted or +unverified deployments as errors, and retain pending recovery without replaying it. Skill checks include missing installations, drift, broken links, newer matching source revisions, and uncommitted source content. Instruction checks include missing -or drifted blocks, adoption/conflicts, missing locks, sections at both scopes, -Claude forwarding and ancestor files, Codex override files and size limits, -source changes, and invalid configuration. `--root` audits both kinds. +or drifted targets, locked targets that agents did not generate, own files +changed since the lock, links that no longer resolve, missing locks, sections at +both scopes, Claude forwarding (including a Claude file that hides a nested +`AGENTS.md`) and ancestor files, Codex override files and the project size limit, source changes, and +invalid configuration. `--root` audits every managed kind. With `--ci`, a missing or changed locked skill or instruction target also produces exit status 1. An available upstream update alone remains informational. Use `--require-organization-policy` when CI must load an organization install policy or organization source allowlist. The audit checks locked sources against each applicable source policy. A violation or an unreadable policy produces an error and exit status 1. `--root` accepts multiple directories, either after one option or repeated. Each root is an explicit project directory; `--root` cannot combine with user scope. A nonexistent root is an error. Without roots, project scope uses the @@ -506,8 +909,25 @@ current directory and user scope uses HOME. | Scope | Declaration | Lock | Cache | | --- | --- | --- | --- | -| Project | `.agent/agents.json` | `.agent/agents.resolved` | `.agent/cache/` | -| User | `~/.agents/agents.json` | `~/.agents/agents.resolved` | `~/.agents/cache/` | +| Project | `.agent/agents.yaml` | `.agent/agents.resolved` | `.agent/cache/` | +| User | `~/.agents/agents.yaml` | `~/.agents/agents.resolved` | `~/.agents/cache/` | + +A project commits its declaration and lock; the cache stays local. `agents.yaml` +uses the [manifest format](https://github.com/agents-tools/core/blob/25d965fa18465f60341ba81bff4a511766d7659b/Documentation/Reference/Manifest.md), +a versioned YAML mapping with required `version: 1`. Sources are named mappings; +components are ordered sequences. Unknown structural fields produce located +diagnostics. The declaration schema and parser are owned by core. Lifecycle +commands use core's deployable subset; unsupported deployment constructs produce +located diagnostics, while dump accepts the complete format. Add, remove and +recipient edits preserve comments and bytes outside the supported edit. +If declaration semantics are unchanged, the original bytes stay untouched, +including authored formatting. An unchanged update also leaves lock bytes +untouched. `agents.resolved` remains tool-owned JSON, formatted by core when it +changes. + +An empty scope can be inspected without creating state. `manifest dump` requires +an existing declaration and reports its selected path when absent. Lock or watch +state without `agents.yaml` is an error; restore the declaration before retrying. Project roots are the current directory, not a search up the Git ancestry. Core resolves installation locations, including `CODEX_HOME`, @@ -527,6 +947,56 @@ recovery, run `agents install --scope user` for `~/.agents`, or run Commands that change a scope finish pending recovery before proceeding. When core reports recovery, the CLI prints a notice on stderr and retries that operation once. A second recovery or any other failure stops the command. +When core reports an unresolved transaction conflict, doctor emits error checks +`unresolved-transaction` (skills) and `unresolvedTransaction` (instructions), +retains core's owner-action message and locations, and exits 1. Inspect those +locations and resolve the conflict before retrying. Read operations preserve +both pending journals and conflicts. + +## Content Audit + +`agents audit` inspects recognized local prompt surfaces in the current +directory (project scope) or HOME (`--scope user`). It discovers prompts even +before a lock exists. Repeat `--agent` to limit discovery to selected clients: +`codex`, `claude-code`, `cursor`, `gemini-cli`, `opencode`, or `antigravity`. +Scope scans include scope-wide prompt surfaces and check present, admitted +managed content against recorded hashes where available. For deployment +presence, source policy, and full deployment drift, use `agents doctor`. + +`--file ` inspects one file inside the selected scope. Relative paths +resolve from the current directory. It accepts recognized native documents +and text prompts, including `.md`, `.mdc`, `.txt`, and `.prompt`. Native +documents contribute only recognized prompt fields. An explicit file scan +uses recorded ownership without comparing recorded content hashes. + +All scan formats go to stdout. Markdown is the default and summarizes +scanned, skipped, and incomplete targets. JSON includes `targets`, `findings`, +`passesCI`, and `ciExitCode`. SARIF 2.1.0 reports findings for code scanning. +Locations are scope-relative. Native findings identify the decoded prompt +field and include physical coordinates when Core can map them. Skipped +targets, such as a native document without prompt fields, are distinct from +incomplete coverage. Discovery stays inside the scope, skips protected paths +and nested repositories, and admits linked skills through matching ledger +entries. Incomplete coverage is a critical finding, including when an +admitted prompt is unreadable or scope recovery is pending. + +| Exit | Scan | Scan with `--ci` | +| --- | --- | --- | +| 0 | Clean or informational findings only | No critical findings | +| 1 | Critical findings, including incomplete coverage or detected recorded-content drift | Critical findings | +| 2 | Warning findings without critical findings | Unused | +| 64 | Invalid arguments | Invalid arguments | + +Use `agents audit --file AGENTS.md --strip` to preview deletions by location, +Unicode code point, and reason. The preview shows no prompt text and leaves +the file untouched. Rerun with `--apply` to prepare and apply a checked preview +in that invocation. Core verifies the file identity and bytes before +publishing the replacement. Strip accepts one regular, unshared, +non-executable UTF-8 text prompt and preserves all other bytes. It exits 0 +on a successful preview or apply, or 1 on refusal or failure. Use the scan +again to check the result. Native settings and linked files require manual +edits. If you edit a managed file in place, update its source and refresh +the deployment as needed. ## Output and Exit Status @@ -548,14 +1018,14 @@ including ESC, CR, C1, and bidi controls, use visible escapes: ```text Error: No ChatGPT prompt named 'daily' is declared. - Declare it under instructions.chatgpt in agents.json and run 'agents instructions update --apply'. + Declare it under chatgpt in the instructions component of agents.yaml and run 'agents instructions update --apply'. Error: Unknown option '--all'. Did you mean '--path'? Run 'agents --help' for usage. ``` Git failures name the operation and source, followed by Git's diagnostics and -a remedy. For a source alias `missing` declared in `.agent/agents.json` as -`{"git": "file://localhost/missing/skills.git"}`, a failed add reports: +a remedy. For a source alias `missing` declared in `.agent/agents.yaml` as +`sources: {missing: {url: "file://localhost/missing/skills.git"}}`, a failed add reports: ```text $ agents skills add missing demo @@ -585,16 +1055,23 @@ Unknown commands and subcommands report `Unknown command ''` and exit Command-path validation stops at `--`; leaf command positionals remain arguments. Doctor's `ok` means there are no error checks; warnings do not make it false. -Instruction `invalidTarget`, `conflict`, `invalidConfiguration`, and -`stateUnavailable` diagnostics and both pending-recovery findings are errors. -Other instruction diagnostics, including drift and missing blocks, are +Instruction `invalidTarget`, `foreignTarget`, `invalidLink`, +`invalidConfiguration`, `stateUnavailable` and `unresolvedTransaction` diagnostics, +the skill `unresolved-transaction` check and both pending-recovery findings +are errors. +Other instruction diagnostics, including drift and missing targets, are warnings. Other skill severities are supplied by core. A failed operation emits no successful JSON report. JSON stdout contains only one object and a trailing newline; recovery notices remain on stderr. ## JSON Schemas -All reports have integer `schemaVersion: 1`. Object keys are sorted. Arrays +The [manifest dump contract](ManifestDump.md) is produced by core and printed +byte-for-byte, with no CLI wrapper or scope field. The remaining schemas are +CLI-owned reports, independent of core's state encodings. + +Every report has an integer `schemaVersion`: 2 for the manifest dump, update, +instruction update and install reports, 1 for the others. Object keys are sorted. Arrays follow core's deterministic ordering; instruction section lists preserve selection order, targets and prompt names are sorted, and doctor roots retain input order. @@ -613,16 +1090,32 @@ schema version. Diagnostic IDs are core-defined strings, not a closed enum. | Command | Schema | Required root fields | | --- | --- | --- | +| `manifest dump --json` | [Manifest dump contract](ManifestDump.md) | Producer-owned manifest object | | `skills list --json` | [Installed list](Schemas/installed-list.schema.json) | `schemaVersion`, `kind: "installed"`, `scope`, `skills` | | `skills list --json` | [Source list](Schemas/source-list.schema.json) | `schemaVersion`, `kind: "source"`, `scope`, `source`, `skills` | -| `update --json`, `skills update --json` | [Update](Schemas/update.schema.json) | `schemaVersion`, `scope`, `changed`, `skills`; top-level update also emits `instructions` | +| `update --json`, `skills update --json` | [Update](Schemas/update.schema.json) | `schemaVersion`, `scope`, `changed`, `skills`; top-level update also emits `instructions` and `components` | | `instructions list --json` | [Managed instructions](Schemas/instructions-installed-list.schema.json) | `schemaVersion`, `kind: "installed"`, `scope`, `sections`, `targets`, `prompts` | | `instructions list --json` | [Instruction source](Schemas/instructions-source-list.schema.json) | `schemaVersion`, `kind: "source"`, `scope`, `source`, `sections` | | `instructions update --json` | [Instruction update](Schemas/instructions-update.schema.json) | `schemaVersion`, `scope`, `changed`, `instructions` | +| `instructions export --json` | [Instruction export](Schemas/instructions-export.schema.json) | `schemaVersion`, `scopes` | | `watch status --json`, `watch --json` | [Watch status](Schemas/watch-status.schema.json) | `schemaVersion`, `scope`, `sources` | | `watch diff --json` | [Watch diff](Schemas/watch-diff.schema.json) | `schemaVersion`, `scope`, `source` | -| `install --json` | [Install](Schemas/install.schema.json) | `schemaVersion`, `scope`, `skills`, `instructions` | +| `lifecycle … --json` | [Lifecycle reports](Schemas/lifecycle.schema.json) | `schemaVersion`, `kind` and fields for each command | +| `install --json` | [Install](Schemas/install.schema.json) | `schemaVersion`, `scope`, `skills`, `instructions`, `components` | | `doctor --json` | [Doctor](Schemas/doctor.schema.json) | `schemaVersion`, `ok`, `roots` | +| `components list --json` | [Components](Schemas/components-list.schema.json) | `schemaVersion`, `kind`, `scope`, `components` | +| `import --json` | [Import](Schemas/import.schema.json) | `schemaVersion`, `kind`, `format`, `sources`, `components`, `diagnostics`, `bindings`, `resources` | +| `mcp search --json` | [MCP registry search](Schemas/mcp-registry-page.schema.json) | `schemaVersion`, `servers` | +| `mcp show --json` | [MCP registry server](Schemas/mcp-registry-server.schema.json) | `schemaVersion`, `name`, `version`, `description`, `choices` | +| `mcp add --json` | [Update](Schemas/update.schema.json) | `schemaVersion`, `scope`, `changed`, `skills`, `instructions`, `components` | +| `auth check --json` | [Source credential status](Schemas/auth-check.schema.json) | `schemaVersion`, `transport`, `availability`, and optional `scope`, `provider`, `effectiveHost`, `credentialSource`, `validation` | +| `cache info/clean/prune --json` | [Download cache](Schemas/cache.schema.json) | See the inventory, preview and removal alternatives. | +| `marketplace resolve --json` | [Marketplace resolution](Schemas/marketplace-resolution.schema.json) | `schemaVersion`, `scope`, `roots`, `nodes` | +| `marketplace install/upgrade/remove --lock-only --json` | [Pending lock](Schemas/marketplace-pending.schema.json) | `schemaVersion`, `resolution`, `pendingDigest`, `changed`, `policyFindings` | +| `marketplace deploy --json` | [Update](Schemas/update.schema.json) | Native changes from the pending lock | +| `marketplace install/upgrade/remove --json` for graph packages | [Marketplace preview](Schemas/marketplace-preview.schema.json) | `schemaVersion`, `resolution`, `update`, `affectedRoots`, `pinChanges` | +| `marketplace install/upgrade/remove --json` for exact leaf packages | [Update](Schemas/update.schema.json) | `schemaVersion`, `scope`, `changed`, `skills`, `marketplaceChanges` when pins change | +| `mcp test --json` | [MCP test](Schemas/mcp-test.schema.json) | `schemaVersion`, `kind`, `transport`, `outcome`, `cleanupComplete`, `elapsed`, `tools` | An empty installed list: @@ -633,7 +1126,7 @@ An empty installed list: An empty skill update preview: ```json -{"schemaVersion":1,"scope":"project","changed":false,"skills":[]} +{"schemaVersion":2,"scope":"project","changed":false,"skills":[]} ``` A healthy doctor report: @@ -650,10 +1143,9 @@ physical `path`, `before` and `after`. Membership states use `{"kind":"absent"}` or `{"kind":"installed","mode":"link|copy|edit"}`. Rows include unchanged membership and are sorted by agent ID. A missing lock means before membership is unrecorded. Regular skill file snapshots add boolean -`executable`; existing `kind` and `base64` retain their meanings. These additive -fields retain schema version 1 and are optional in the schema so older reports -remain valid. -Doctor checks add `kind: "skills" | "instructions"`; existing fields and IDs +`executable`; existing `kind` and `base64` retain their meanings. These fields +are optional in the schema. +Doctor checks add `kind: "skills" | "instructions" | "components"`; existing fields and IDs remain, and instruction IDs use core's diagnostic names. Consumers distinguish checks by `(kind, id)` because kinds may use the same ID. @@ -664,10 +1156,14 @@ The shared [instruction definitions](Schemas/instructions.schema.json) describe: `changed` (file bytes differ), `agentsChanged` (recipients differ), `beforeAgents` (previous agent IDs, or `null` when no lock entry existed), `afterAgents` (planned agent IDs, empty when no longer managed), optional - `before`/`after` file snapshots, optional `drift`, `adoptedSections`, and - `conflicts` with existing/proposed text and difference. Agent IDs use their - raw values in deterministic order. + `before`/`after` file snapshots, optional `drift` (`clean`, `drifted` or + `missing`, against the previous lock), and `foreign` (the proposed destination + holds a file that agents did not generate). Agent IDs use their raw values in + deterministic order. - `changedPrompts`: prompt names whose content definition changed. +- `advisories`: optional nonblocking messages from Core, such as the shared + Antigravity rule budget, which can appear on a preview without changes. +- `conflicts`: optional messages from Core about conditions that block apply. - `lockMissing`: no scope lock existed when the operation began. - `changed`: applying changes the declaration, locked state, or target bytes, including recipient-only changes with identical file bytes and targets that @@ -677,8 +1173,20 @@ Instruction file snapshots use the same `{ "kind": "file", "base64": "…" }` shape as skill files. `install --json` reports restored skill rows and instruction restoration differences; instruction `sections` and `changedPrompts` are empty because install never resolves new content. +Top-level update and install add `components` without changing their version 2 +contracts. Component rows identify kind, name, source, destination, recipients, +format, ownership, symbolic before/after values, required binding names, resource +hashes, effective readers and planned permission changes. Provider values are +never included. Scoped skill/instruction reports retain their existing shapes. The definitions are CLI-owned and do not expose core's encoded lock objects. +Instruction source listings add each file's `level`, `description` and `paths` +beside its `heading`. The export report lists `scopes`, the user scope first, +each with `scope`, absolute `root`, `status` (`locked`, `missingLock`, +`pendingRecovery` or `unavailable` with a `message`), `targets` (each with its +lock key `target`, sorted `agents`, optional `import` for a Claude forwarding +file, and the `sections` it receives), `unplaced` sections and `prompts`. + Watch `sources` entries (and the single diff `source` object) include `alias`, normalized `source`, `seen`, `current`, optional Git `commitCount`, and `changes`. Each baseline is either `{ "revision": "" }` or @@ -690,3 +1198,24 @@ Each baseline is either `{ "revision": "" }` or `kind: "file"`, `base64`, and boolean `executable`. Directory and symlink entries use the same shapes as update previews. Status omits file snapshots. Artifact digests may change with zero file differences; `fileCount` remains zero. + + +## Source policies + +Run `agents policy status --scope project` to inspect the organization policies selected for a workspace. Select an organization install policy by setting `AGENTS_USER_ORGANIZATION_POLICY` or `AGENTS_PROJECT_ORGANIZATION_POLICY` to an absolute file path, an HTTPS policy URL, or `github:OWNER/REPO`. The report shows each governing document and its digest. Add `--json` for the full findings with subject, rule, authority and dependency path. Blocking findings cause exit status 1. Advisory findings remain visible in both this report and `agents doctor --ci`. + +Use `agents policy show --scope project` to see the applicable organization, +user and project policies. Add `--json` for structured output. Preview a file +with `agents policy set rules.yaml --scope project` and add `--apply` to save +it in `.agent/source-policy.yaml`. Use `--scope user` to edit +`~/.agents/source-policy.yaml`. Set `AGENTS_ORGANIZATION_SOURCE_POLICY` to the +path of an administrator-managed policy. A source must pass every applicable +layer. Run `agents doctor --ci` to check installed configuration in CI. + +```yaml +version: 1 +allow: + - git: https://github.com/example/team-skills + - http: https://registry.example.org + - inline +``` diff --git a/sources/cli/README.md b/sources/cli/README.md index a126b10..e904a36 100644 --- a/sources/cli/README.md +++ b/sources/cli/README.md @@ -7,13 +7,13 @@

agents

- Install and update agent skills and instructions, resolved to exact versions. + Manage agent components from declared sources, resolved to exact versions.

CI Swift 6.3+ - Platforms: macOS 15+ + Platforms: macOS 15+ and Linux License: MIT

@@ -30,9 +30,9 @@ ## Overview -Declare skills and instruction sections once, restore their locked content with -`install`, and preview upstream changes before applying an update. `agents` -supports Codex, Claude Code, Cursor, Gemini CLI, and OpenCode through +Declare skills, instructions, commands, subagents, MCP servers and settings once, +restore their locked content with `install`, and preview changes before applying +an update. `agents` supports Codex, Claude Code, Cursor, Gemini CLI, OpenCode, and Antigravity through [agents-tools/core](https://github.com/agents-tools/core). The executable owns commands and terminal presentation. Core owns source @@ -54,9 +54,8 @@ an upstream change: ## Install -Development builds and the next release require macOS 15 or later. Earlier -releases retain their original requirements; the Homebrew formula's requirement -changes with the release that ships this minimum. +On macOS, versions 0.1.2 and later and development builds require macOS 15 or later. +Earlier releases retain their original requirements. Install the latest release from the Homebrew tap: @@ -74,7 +73,7 @@ brew install --HEAD agents-tools/tap/agents See the [tap documentation](https://github.com/agents-tools/homebrew-tap#readme) for packaging and channel details. -To build from source instead: +To build from source on macOS or Linux: ```sh git clone https://github.com/agents-tools/cli.git @@ -83,8 +82,7 @@ swift build -c release .build/release/agents --help ``` -Place `.build/release/agents` in a directory on your `PATH`. To run from this -checkout, use `.build/release/agents` or `swift run agents`. +To run from this checkout, use `.build/release/agents` or `swift run agents`. ## Usage @@ -93,8 +91,11 @@ agents skills add https://github.com/anthropics/skills.git --all --agent codex agents skills list agents skills list --scope user --json agents instructions add /path/to/rules canonical-artifacts +agents instructions init review +agents instructions add . review agents instructions list agents instructions update --apply +agents instructions export --json agents instructions render chatgpt weekly | pbcopy agents watch add https://github.com/anthropics/skills.git agents watch @@ -106,8 +107,21 @@ agents update --apply agents skills remove pdf agents skills init my-skill agents doctor --root /path/to/project-a /path/to/project-b --json +agents manifest dump --json +agents components list --json +agents components list /path/to/source --alias team --group tools --json +agents components add /path/to/source --alias team --group tools +agents components remove review --kind command +agents import review.md --root /path/to/source --format claudeCommandV1 +agents import review.md --root /path/to/source --format claudeCommandV1 --apply +agents mcp test local-tools --binding token=TOOLS_TOKEN --json ``` +Declarations live in `.agent/agents.yaml` for project scope or +`~/.agents/agents.yaml` for user scope. The [manifest format](https://github.com/agents-tools/core/blob/0.3.1/Documentation/Reference/Manifest.md) +uses a versioned YAML mapping. `agents manifest dump --json` prints the +local declaration as a JSON object with source locations without resolving sources. + Project scope is the default and uses the current directory. User scope is selected with `--scope user`. Commands never prompt for confirmation. @@ -115,23 +129,41 @@ selected with `--scope user`. Commands never prompt for confirmation. changes since the last `watch seen`, and previews file differences. Removing a subscription with `watch remove` keeps installed skills and instructions. -Instructions are Markdown sections discovered in a source's `instructions/` or -`.agents/instructions/` directory. Managed blocks preserve surrounding custom -content in agent files, with Claude forwarding where needed. `--agent` on -instructions add, remove, or update sets the recipients of the scope's entire -section list. `agents instructions init ` creates `.md`. - -Named ChatGPT prompts are declared in `agents.json` and locked with +Instructions are Markdown files with front matter, discovered in a source's +`instructions/` or `.agents/instructions/` directory, or in the project's own +`.agent/instructions/` as source `.`. Each agent file is generated from its +sections, a section with `paths` goes to the nested file of the directory its +patterns share, and Claude is forwarded where needed. A file that agents did not +generate is taken over only with `--replace`. Use `--agent antigravity` on `instructions add` to install one Markdown rule +per selected section in `.agents/rules/` (project) or `~/.gemini/config/rules/` (user). +`agents instructions init ` creates `.agent/instructions/.md`, and +`agents instructions export` maps locked targets to their sections. + +Named ChatGPT prompts are declared in `agents.yaml` and locked with `agents instructions update --apply`; render emits only their locked sections and optional custom content. Updates identify changed prompts to re-paste. -Top-level `update` previews skills and instructions together and applies them in -one transaction. `install` and `doctor` process skills then instructions. -All three support combined `--json` reports. +Top-level `update` previews all declared components and applies them in one +transaction. `install` restores the exact locked components in one transaction; +`doctor` audits managed deployments without recovery or writes. All three +support combined `--json` reports. + +`components list` inspects current components or discovers an exported source +group. `components add` applies that group; `components remove` uses an exact +managed identity and optional occurrence when names are ambiguous. Producer-owned +members remain editable at their declaring source. `import` previews an explicit +producer document and applies its canonical intent only with `--apply`. + +`mcp test` explicitly starts or contacts one selected managed MCP server and +discovers its tools. Runtime bindings use repeated `--binding NAME=ENV_VAR` +mappings on apply or test commands. Values are read only when Core requests that +symbolic binding and are not included in reports. See the [CLI reference](Documentation/Reference/CLI.md) +for supported profiles, selection options and report schemas. ## Requirements -- macOS 15 or later. +- macOS 15 or later, or Linux (source build). - Swift 6.3 or later to build from source. +- SQLite 3 headers and library for Linux source builds (`libsqlite3-dev` on Ubuntu). - Git for Git-backed sources. ## Documentation @@ -153,7 +185,16 @@ then follow the repository's [contributing guide](CONTRIBUTING.md) and ```sh swift build -env -u CODEX_HOME -u CLAUDE_CONFIG_DIR -u XDG_CONFIG_HOME -u XDG_STATE_HOME -u XDG_CACHE_HOME swift test +python3 - <<'PYTEST' +import os, subprocess, tempfile +with tempfile.TemporaryDirectory(prefix="agents-test-home-") as test_home: + environment = {key: value for key, value in os.environ.items() + if key not in ("CODEX_HOME", "CLAUDE_CONFIG_DIR") + and not key.startswith(("XDG_", "GIT_"))} + environment.update(HOME=test_home, GIT_CONFIG_NOSYSTEM="1", + GIT_CONFIG_GLOBAL="/dev/null") + subprocess.run(["swift", "test"], env=environment, check=True) +PYTEST swift build -c release swift format lint --strict --configuration .swift-format --recursive Package.swift Sources Tests ``` @@ -162,19 +203,19 @@ Executable tests create local Git sources and isolated homes in the system temporary directory. Every child process uses an explicit environment rather than inheriting agent or Git configuration. Fixtures are removed after tests. -Core uses a full revision pin during this development change. To use a local core worktree without -changing the package manifest: +Core is pinned to an exact development revision in `Package.swift` and +`Package.resolved`. To use an authorized local core worktree without changing +the package manifest: ```sh swift package resolve swift package edit core --path /path/to/core-worktree -swift test +# Run the isolated test command above. swift package unedit core ``` -Keep the local edit inside your authorized development scope. Releases switch -to a version range according to the -[release checklist](Documentation/Reference/Release.md). +Keep the local edit inside your authorized development scope. Follow the +[release checklist](Documentation/Reference/Release.md) when preparing a release. The CLI version is defined once in `Sources/CLI/EntryPoint.swift`. ### Continuous integration @@ -189,8 +230,11 @@ declared in the organization's | `policy / policy` | Conventional Commit subjects, PR title, and added-line policy | | `validate / result` | Strict format lint, package tests, release build, and terminal recording check | -[Package configuration](.github/swift-package.json) selects only Xcode 26.6 on -`macos-26`, whose Swift 6.3 matches the package's minimum tools version. +[Package configuration](.github/swift-package.json) selects Xcode 26.6 on +`macos-26` and a pinned Swift 6.4.1 Noble container image for Linux validation. +The Linux job installs the SQLite development package and runs the CLI suite +as the checkout owner. +[Package.swift](Package.swift) defines the minimum toolchain and macOS versions. Formatting uses the default paths: `Package.swift`, `Sources`, and `Tests`. Executable tests cover help, version, and usage errors in an isolated environment.