Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8b20d0b
Initial plan
Copilot Mar 20, 2026
3212309
Add agent pack infrastructure with embedded packs, manifest validatio…
Copilot Mar 20, 2026
ec5471a
Fix code review issues: safe teardown for shared dirs, less brittle t…
Copilot Mar 20, 2026
b5a5e3f
Add installed-file tracking with SHA-256 hashes for safe agent teardown
Copilot Mar 20, 2026
a63c248
Move file recording to finalize_setup() — called after init pipeline …
Copilot Mar 20, 2026
e190116
refactor: setup reports files, CLI checks modifications before teardo…
Copilot Mar 20, 2026
c3efd1f
style: fix f-string formatting in _reregister_extension_commands
Copilot Mar 20, 2026
c2227a7
feat: add --agent flag to init for pack-based flow with file tracking
Copilot Mar 20, 2026
d6016ab
style: simplify --agent help text, normalize comment spelling
Copilot Mar 20, 2026
9b580a5
feat: setup() owns scaffolding and returns actual installed files
Copilot Mar 20, 2026
978addc
refactor: simplify finalize_setup scan to agent_root only, improve co…
Copilot Mar 20, 2026
55bcbd3
fix: resolve all ruff check failures (F541 f-string placeholders, F40…
Copilot Mar 23, 2026
795f1e7
fix: add explanatory comments to all empty except clauses (code quality)
Copilot Mar 23, 2026
00117c5
feat: address all 10 code quality issues — ID validation, rollback, D…
Copilot Mar 23, 2026
ab8c58f
fix: improve test match specificity and rollback error message per co…
Copilot Mar 23, 2026
b94e541
fix: address PR review — legacy teardown, generic agent, ~/.specify p…
mnriem Mar 23, 2026
7904482
fix: address PR review round 2 — legacy rmtree confirmation, agent_pa…
mnriem Mar 23, 2026
34fa61e
docs: clarify that tracking all setup files is intentional (safe due …
mnriem Mar 23, 2026
48392ea
fix: hash-check before deletion, track all files, fix overrides bug, …
mnriem Mar 23, 2026
720ac50
fix: path traversal guard, rollback extension re-registration, lifecy…
mnriem Mar 23, 2026
433502b
fix: force flag passthrough, cross-platform hashes, manifest retentio…
mnriem Mar 23, 2026
ca9c73d
docs: explain extension file overlap in finalize_setup scan comment
mnriem Mar 23, 2026
38ae759
fix: stale manifest cleanup, resolve with project_path, AGENTS.md add…
mnriem Mar 23, 2026
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
52 changes: 52 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,56 @@ When adding new agents:

---

## Agent Pack System (new)

The agent pack system is a declarative, self-contained replacement for the legacy `AGENT_CONFIG` + case/switch architecture. Each agent is defined by a `speckit-agent.yml` manifest and an optional `bootstrap.py` module. When `bootstrap.py` is absent, the built-in `DefaultBootstrap` class derives its directory layout from the manifest's `commands_dir` field.

### `--agent` flag on `specify init`

`specify init --agent <id>` uses the pack-based init flow instead of the legacy `--ai` flow. Both accept the same agent IDs, but `--agent` additionally enables installed-file tracking so that `specify agent switch` can cleanly tear down agent files later.

```bash
specify init my-project --agent claude # Pack-based flow (with file tracking)
specify init --here --agent gemini --ai-skills # With skills
```

`--agent` and `--ai` are mutually exclusive. When `--agent` is used, `init-options.json` gains `"agent_pack": true`. The `generic` agent (which requires `--ai-commands-dir`) falls through to the legacy flow since it has no embedded pack.

### `specify agent` subcommands

| Command | Description |
| ------------------------------- | ----------- |
| `specify agent list` | List all available agent packs |
| `specify agent list --installed`| List only agents installed in the current project |
| `specify agent info <id>` | Show detailed information about an agent pack |
| `specify agent switch <id>` | Switch the active agent (tears down old, sets up new) |
| `specify agent search [query]` | Search agents by name, ID, description, or tags |
| `specify agent validate <path>` | Validate an agent pack directory |
| `specify agent export <id>` | Export an agent pack for editing |
| `specify agent add <id> --from <path>` | Install an agent pack from a local directory |
| `specify agent remove <id>` | Remove a cached/override agent pack |

Comment on lines +447 to +458
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AGENTS.md says specify agent add <id> installs an agent pack “from a local path”, but the implemented CLI currently requires --from <path> and otherwise exits with “Catalog fetch not yet implemented.” Update the subcommand table/description to reflect the actual required flags (and/or note that catalog install isn’t implemented yet).

Suggested change
| Command | Description |
| ------------------------------- | ----------- |
| `specify agent list` | List all available agent packs |
| `specify agent list --installed`| List only agents installed in the current project |
| `specify agent info <id>` | Show detailed information about an agent pack |
| `specify agent switch <id>` | Switch the active agent (tears down old, sets up new) |
| `specify agent search [query]` | Search agents by name, ID, description, or tags |
| `specify agent validate <path>` | Validate an agent pack directory |
| `specify agent export <id>` | Export an agent pack for editing |
| `specify agent add <id>` | Install an agent pack from a local path |
| `specify agent remove <id>` | Remove a cached/override agent pack |
| Command | Description |
| ----------------------------------------- | ----------- |
| `specify agent list` | List all available agent packs |
| `specify agent list --installed` | List only agents installed in the current project |
| `specify agent info <id>` | Show detailed information about an agent pack |
| `specify agent switch <id>` | Switch the active agent (tears down old, sets up new) |
| `specify agent search [query]` | Search agents by name, ID, description, or tags |
| `specify agent validate <path>` | Validate an agent pack directory |
| `specify agent export <id>` | Export an agent pack for editing |
| `specify agent add <id> --from <path>` | Install an agent pack from a local path |
| `specify agent remove <id>` | Remove a cached/override agent pack |
> Note: Running `specify agent add <id>` without `--from <path>` currently exits with
> "Catalog fetch not yet implemented." Catalog-based installation is not yet supported.

Copilot uses AI. Check for mistakes.
> **Note:** `specify agent add <id>` without `--from <path>` is reserved for future catalog-based installation, which is not yet implemented.

### Pack resolution order

Agent packs resolve by priority (highest first):
1. **User-level** (`~/.specify/agents/<id>/`) — applies to all projects
2. **Project-level** (`.specify/agents/<id>/`) — project-specific override
3. **Catalog cache** (downloaded via `specify agent add`)
4. **Embedded** (bundled in the specify-cli wheel)

### Trust boundary

Agent packs can include a `bootstrap.py` module that is dynamically imported and executed. Pack authors can run arbitrary code through this mechanism. Only install packs from trusted sources. The 4-level resolution stack means that placing a pack in any of the resolution directories causes its code to run when the agent is loaded.

### Installed-file tracking

When using `--agent`, all installed files are recorded in `.specify/agent-manifest-<id>.json` with SHA-256 hashes. During `specify agent switch`, the CLI:
1. Checks for user-modified files before teardown
2. Prompts for confirmation if files were changed
3. Feeds tracked file lists into teardown for precise, file-level removal (directories are never deleted)

---

*This documentation should be updated whenever new agents are added to maintain accuracy and completeness.*
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ packages = ["src/specify_cli"]
"scripts/powershell" = "specify_cli/core_pack/scripts/powershell"
".github/workflows/scripts/create-release-packages.sh" = "specify_cli/core_pack/release_scripts/create-release-packages.sh"
".github/workflows/scripts/create-release-packages.ps1" = "specify_cli/core_pack/release_scripts/create-release-packages.ps1"
# Official agent packs (embedded in wheel for zero-config offline operation)
"src/specify_cli/core_pack/agents" = "specify_cli/core_pack/agents"

[project.optional-dependencies]
test = [
Expand Down
Loading
Loading