feat(agents): Add subagent runtime support#106
Open
dcramer wants to merge 20 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Convert unmanaged canonical subagent file conflicts into typed store errors and InstallError at the install boundary. This preserves user-owned files while letting the CLI print a clean message instead of surfacing an unexpected exception. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Document subagent lockfile and trust behavior, keep subagent runtime pruning explicit, and avoid exposing subagent internals on the host package surface. Make git-heavy tests deterministic under the full Vitest suite and keep install test setup lazy for path-only cases. Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Remove stale managed skill directories whenever install rewrites them out of the lockfile, while preserving in-place local skills. Guard stale deletion with a safe managed skill path so malformed lockfile keys cannot delete unrelated files. Also tolerate BOM-prefixed markdown frontmatter with spaces after the opening marker when parsing or marking native subagent files. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Treat empty subagent targets as every configured agent and make managed marker detection format-aware so body text is not trusted. Keep frozen installs from pruning managed subagent files or dropping their gitignore entries, while normal installs still prune explicitly. Co-Authored-By: Codex <codex@openai.com>
Load configured subagents from the installed store during frozen installs instead of resolving their sources. This keeps frozen installs network-free for subagents while preserving managed files and lock entries. Co-Authored-By: Codex <codex@openai.com>
Keep declared managed runtime files out of prune candidates even when an unmanaged file claims the same subagent identity. This leaves the conflict visible as a warning or sync issue without deleting the configured output. Write the prepared lockfile before mutating installed subagent files so a write conflict does not discard lock updates after skill directories have changed. Co-Authored-By: OpenAI Codex <codex@openai.com>
Update install to write skill lock changes while preserving prior subagent lock entries until installed subagent files are written successfully. Include lockfile-tracked subagents when sync regenerates .agents/.gitignore so generated files remain ignored until stale entries are pruned. Co-Authored-By: OpenAI Codex <codex@openai.com>
When subagent writes fail during install, preserve only previously locked subagent entries that still match the newly resolved lock. This lets skill lock updates land without carrying removed or updated subagent entries forward. Co-Authored-By: Codex <codex@openai.com>
Move the fallback install lockfile write into the subagent error path so successful subagent file writes can be reflected when later pruning fails. Failed subagent writes still preserve only unchanged prior subagent lock entries while keeping skill lock updates. Co-Authored-By: Codex <codex@openai.com>
Sync should repair generated runtime configs from the subagents that were successfully loaded, not every declared subagent. This removes stale generated files when a declared subagent is missing or fails to load. Co-Authored-By: OpenAI Codex <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aadfa12. Configure here.
Sync reports declared subagents that are not installed, but it should not delete their generated runtime files. Preserve those files until install can repair the canonical subagent source. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Pruning should only inspect files that may be removed. Skip desired runtime files before reading them so unreadable desired files do not abort install or sync. Co-Authored-By: OpenAI Codex <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add
[[subagents]]so a repo can declare reusable coding-agent subagents once, install them into.agents/agents/, and generate runtime-native files for Claude, Cursor, Codex, and OpenCode.Typical Project Usage
A project can point at a shared agent pack and let dotagents generate files for every configured runtime that supports subagents:
If the upstream repo contains
agents/code-reviewer.md,dotagents installwrites the canonical installed file plus runtime outputs:Native Sources Stay Native
Teams can also publish native agent files directly. For example, a Codex-first source can keep Codex-specific fields in
.codex/agents/code-reviewer.toml:When installing to Codex, dotagents preserves that TOML as the Codex output and only adds the managed-file marker. When installing to Claude, Cursor, or OpenCode, it generates Markdown from the portable
name,description, and instructions instead of trying to standardize Codex-only behavior.Explicit File Selection
Conventional directories such as
agents/,.agents/agents/,.claude/agents/,.cursor/agents/,.codex/agents/, and.opencode/agents/are discovered automatically. Root-level Markdown files require an explicit path so unrelated docs do not get imported by accident:Install and sync both understand the generated files.
install --frozenvalidates declared subagents againstagents.lock,syncrepairs or prunes managed subagent files without network access, anddoctor --fixpreserves lockfile subagent ignore entries until stale files are pruned.