Skip to content

Add generic agent support (bring your own agent)#1639

Open
mnriem wants to merge 1 commit intogithub:mainfrom
mnriem:feature/generic-agent-support
Open

Add generic agent support (bring your own agent)#1639
mnriem wants to merge 1 commit intogithub:mainfrom
mnriem:feature/generic-agent-support

Conversation

@mnriem
Copy link
Collaborator

@mnriem mnriem commented Feb 19, 2026

Summary

Adds --ai generic --ai-commands-dir <path> support to specify init, enabling users with unsupported AI agents to scaffold Spec Kit projects immediately.

Closes #1638

Changes

Core CLI (src/specify_cli/__init__.py):

  • Added generic to AGENT_CONFIG (folder=None, requires_cli=False)
  • Added --ai-commands-dir parameter to init()
  • Validation: required with --ai generic, rejected with other agents
    user's --ai-commands-dir path
  • Excluded generic from check() command (not a real tool to check)
  • Security notice uses user-specified directory for generic

Release packaging (3 scripts):

  • Added generic to agent lists and case/switch statements
  • Uses .speckit/commands/ as placeholder directory in ZIPs

Agent context scripts (bash + PowerShell):

  • Added generic case with informational message

Documentation:

  • README: updated supported agents table, options table, examples
  • AGENTS.md: added generic to agent table
  • CHANGELOG: added 0.1.1 entry
  • pyproject.toml: version bump to 0.1.1

Usage

specify init my-project --ai generic --ai-commands-dir .myagent/commands/

Testing

All 39 existing tests pass.

Copilot AI review requested due to automatic review settings February 19, 2026 23:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds generic agent support to Spec Kit, allowing users with unsupported AI agents to scaffold projects immediately by specifying their agent's command directory. The PR also includes undocumented support for the Antigravity (agy) agent.

Changes:

  • Added --ai generic --ai-commands-dir <path> support for bring-your-own-agent functionality
  • Added Antigravity (agy) as a new supported agent (undocumented in PR description)
  • Updated release packaging, agent context scripts, and documentation

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/specify_cli/init.py Added generic and agy to AGENT_CONFIG, --ai-commands-dir parameter with validation, directory renaming logic for generic agent, check command exclusion for generic
scripts/powershell/update-agent-context.ps1 Added agy and generic cases to agent context update script
scripts/bash/update-agent-context.sh Added agy and generic cases to agent context update script
pyproject.toml Version bump to 0.1.1
README.md Updated supported agents table and CLI reference with agy, generic, and --ai-commands-dir option
CHANGELOG.md Added 0.1.1 release entry documenting generic agent support
AGENTS.md Added Generic to agent table
.gitignore Removed trailing whitespace (cosmetic)
.github/workflows/scripts/create-release-packages.sh Added agy and generic to agent list and build cases
.github/workflows/scripts/create-release-packages.ps1 Added generic to agent list (missing agy support)
.github/workflows/scripts/create-github-release.sh Added agy and generic template packages to release uploads
Comments suppressed due to low confidence (2)

src/specify_cli/init.py:1114

  • When users run the init command without the --ai flag, the interactive agent selection menu includes 'generic' as an option (line 1102 creates choices from all agents in AGENT_CONFIG). However, if a user selects 'generic' interactively, they will immediately hit the validation error at line 1111 because --ai-commands-dir cannot be provided through the interactive flow. Consider either excluding 'generic' from the interactive menu, or prompting for the commands directory when 'generic' is selected interactively.
    else:
        # Create options dict for selection (agent_key: display_name)
        ai_choices = {key: config["name"] for key, config in AGENT_CONFIG.items()}
        selected_ai = select_with_arrows(
            ai_choices, 
            "Choose your AI assistant:", 
            "copilot"
        )

    # Validate --ai-commands-dir usage
    if selected_ai == "generic":
        if not ai_commands_dir:
            console.print("[red]Error:[/red] --ai-commands-dir is required when using --ai generic")
            console.print("[dim]Example: specify init my-project --ai generic --ai-commands-dir .myagent/commands/[/dim]")
            raise typer.Exit(1)

src/specify_cli/init.py:1195

  • The directory move operation could fail if the target directory already exists. The shutil.move() function will raise an exception if target_dir already exists as a directory. Consider adding a check to handle this case gracefully, either by removing the existing directory first, merging contents, or providing a clear error message to the user.
                    shutil.move(str(placeholder_dir), str(target_dir))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1109 to 1200
@@ -1162,6 +1186,18 @@ def init(

download_and_extract_template(project_path, selected_ai, selected_script, here, verbose=False, tracker=tracker, client=local_client, debug=debug, github_token=github_token)

# For generic agent, rename placeholder directory to user-specified path
if selected_ai == "generic" and ai_commands_dir:
placeholder_dir = project_path / ".speckit" / "commands"
target_dir = project_path / ai_commands_dir
if placeholder_dir.is_dir():
target_dir.parent.mkdir(parents=True, exist_ok=True)
shutil.move(str(placeholder_dir), str(target_dir))
# Clean up empty .speckit dir if it's now empty
speckit_dir = project_path / ".speckit"
if speckit_dir.is_dir() and not any(speckit_dir.iterdir()):
speckit_dir.rmdir()

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The new generic agent functionality, including --ai-commands-dir validation and directory renaming logic, lacks test coverage. Consider adding tests that verify: 1) --ai-commands-dir is required when using --ai generic, 2) --ai-commands-dir is rejected with other agents, 3) the placeholder directory is correctly renamed to the user-specified path, 4) proper cleanup of empty .speckit directory, and 5) edge cases like invalid paths or existing target directories.

This issue also appears on line 1100 of the same file.

Copilot uses AI. Check for mistakes.
@@ -48,6 +48,7 @@ Specify supports multiple AI agents by generating agent-specific command files a
| **Amp** | `.agents/commands/` | Markdown | `amp` | Amp CLI |
| **SHAI** | `.shai/commands/` | Markdown | `shai` | SHAI CLI |
| **IBM Bob** | `.bob/commands/` | Markdown | N/A (IDE-based) | IBM Bob IDE |
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The 'agy' (Antigravity) agent is missing from the Current Supported Agents table in AGENTS.md. Since it's been added to AGENT_CONFIG in init.py, it should also be documented here with its directory (.agent/), format (Markdown), CLI Tool (N/A IDE-based), and description for consistency with other agents.

Suggested change
| **IBM Bob** | `.bob/commands/` | Markdown | N/A (IDE-based) | IBM Bob IDE |
| **IBM Bob** | `.bob/commands/` | Markdown | N/A (IDE-based) | IBM Bob IDE |
| **Antigravity** | `.agent/` | Markdown | N/A (IDE-based) | Antigravity IDE |

Copilot uses AI. Check for mistakes.
- Generates Markdown commands with `$ARGUMENTS` format (compatible with most agents)
- Example: `specify init my-project --ai generic --ai-commands-dir .myagent/commands/`
- Enables users to start with Spec Kit immediately while their agent awaits formal support

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The CHANGELOG entry for version 0.1.1 only mentions the generic agent support but doesn't document the addition of 'agy' (Antigravity) as a new supported agent. Since Antigravity support was added in this PR (as evidenced by changes to AGENT_CONFIG, release scripts, and agent context scripts), it should be included in the CHANGELOG for completeness.

Suggested change
- **Antigravity Agent (`agy`) Support**: Added first-class support for the Antigravity agent
- Use via `--ai agy` to generate commands tailored for the Antigravity agent
- Integrated into agent configuration, release scripts, and agent context handling
- Recognized as a fully supported AI agent alongside existing agents

Copilot uses AI. Check for mistakes.

# Define all agents and scripts
$AllAgents = @('claude', 'gemini', 'copilot', 'cursor-agent', 'qwen', 'opencode', 'windsurf', 'codex', 'kilocode', 'auggie', 'roo', 'codebuddy', 'amp', 'q', 'bob', 'qoder')
$AllAgents = @('claude', 'gemini', 'copilot', 'cursor-agent', 'qwen', 'opencode', 'windsurf', 'codex', 'kilocode', 'auggie', 'roo', 'codebuddy', 'amp', 'q', 'bob', 'qoder', 'generic')
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The PowerShell release packaging script is missing the 'agy' (Antigravity) agent that was added to the bash version (create-release-packages.sh line 233). This inconsistency means the PowerShell script cannot build agy template packages. The 'agy' agent should be added to the $AllAgents array, and a corresponding case should be added to the Build-Variant switch statement (similar to lines 218-220 in the bash version).

Copilot uses AI. Check for mistakes.
Comment on lines 223 to 228
"agy": {
"name": "Antigravity",
"folder": ".agent/",
"install_url": None, # IDE-based
"requires_cli": False,
},
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The PR description and linked issue #1638 don't mention adding support for the 'agy' (Antigravity) agent. This appears to be an undocumented change that was added alongside the generic agent support. The addition of 'agy' should either be documented in the PR description and CHANGELOG, or it should be removed from this PR and added separately to maintain a clear separation of concerns.

Copilot uses AI. Check for mistakes.
Comment on lines +1191 to +1192
placeholder_dir = project_path / ".speckit" / "commands"
target_dir = project_path / ai_commands_dir
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The directory renaming logic doesn't validate that ai_commands_dir is a relative path. If a user provides an absolute path (e.g., '/tmp/commands/'), the behavior of 'project_path / ai_commands_dir' could be unexpected. Consider adding validation to ensure ai_commands_dir is a relative path and doesn't contain '..' to prevent directory traversal or paths outside the project directory.

This issue also appears on line 1195 of the same file.

Suggested change
placeholder_dir = project_path / ".speckit" / "commands"
target_dir = project_path / ai_commands_dir
# Ensure ai_commands_dir is a safe, relative path inside the project directory
ai_path = Path(ai_commands_dir)
if ai_path.is_absolute() or ".." in ai_path.parts:
raise ValueError("ai_commands_dir must be a relative path without '..' components.")
project_root = project_path.resolve()
target_dir = (project_root / ai_path).resolve()
# Ensure the target directory is inside the project directory
if target_dir != project_root and project_root not in target_dir.parents:
raise ValueError("ai_commands_dir must point inside the project directory.")
placeholder_dir = project_path / ".speckit" / "commands"

Copilot uses AI. Check for mistakes.
- Introduced `--ai generic` option for unsupported agents, allowing users to specify their own command directories.
- Updated documentation and examples to reflect the new generic agent support.
- Enhanced scripts and workflows to accommodate the new agent type.
@mnriem mnriem force-pushed the feature/generic-agent-support branch from 89fb41e to 30758f2 Compare February 19, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add generic agent support for unsupported AI agents (bring your own agent)

1 participant

Comments