feat(agents): Add subagent runtime support#106
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
Add a checked-in full example fixture and smoke script that exercises install, list, doctor, sync, generated runtime files, and optional Codex runtime subagent spawning. Document harness-specific QA references so future dotagents changes can distinguish file-level wiring from true runtime proof. Co-Authored-By: Codex <noreply@openai.com>
Preflight installed subagent conflicts before writing canonical files and roll back write-phase failures so the lockfile fallback cannot omit partially written subagents. Preserve trailing blank lines in native subagent overlays by using keep chomping for newline-terminated YAML block scalars. Co-Authored-By: Codex <noreply@openai.com>
Trigger a fresh Warden app evaluation after resolving the stale review thread. Co-Authored-By: Codex <noreply@openai.com>
Replace installed subagent files through same-directory temporary files before renaming them into place. This prevents failed writes from truncating existing managed files and keeps rollback lossless. Co-Authored-By: Codex <noreply@openai.com>
Include the current attempted installed subagent file in rollback so failed write paths restore all affected files conservatively. Co-Authored-By: Codex <noreply@openai.com>
Require installed canonical subagent files to carry the dotagents managed marker before loading them for sync or frozen install. This keeps unmanaged user files from driving generated runtime configs. Co-Authored-By: Codex <noreply@openai.com>
Treat canonical subagent write and prune as one filesystem phase before recording new subagent lock entries. If pruning aborts, keep only unchanged subagent lock entries so the lockfile does not claim a complete install. Co-Authored-By: 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 ff95532. Configure here.
Include lockfile-tracked subagents when remove regenerates .agents/.gitignore. This matches sync and doctor so stale managed canonical subagent files remain ignored until they are pruned. Co-Authored-By: Codex <noreply@openai.com>
Keep the fallback lockfile rewrite best-effort when subagent install or prune fails. This prevents a secondary lockfile write failure from masking the original install failure. Co-Authored-By: Codex <noreply@openai.com>
| const serialized = JSON.stringify(value); | ||
| if (serialized !== undefined) { | ||
| lines.push(`${prefix}${toYamlKey(key)}: ${serialized}`); | ||
| } |
There was a problem hiding this comment.
Bug: The regex in parseMarkdownFrontmatterContent for extracting frontmatter is non-greedy and will terminate prematurely if a YAML block scalar's content contains a line with just ---.
Severity: MEDIUM
Suggested Fix
Replace the regular expression-based frontmatter extraction with a more robust parsing mechanism that correctly handles YAML document separators and does not fail on content that coincidentally contains separator-like sequences.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/dotagents/src/agents/definitions/helpers.ts#L189-L192
Potential issue: The function `parseMarkdownFrontmatterContent` uses a non-greedy
regular expression to extract YAML frontmatter from markdown files. This regex will
terminate at the first occurrence of a line containing `---`. If a native subagent's
content, which is stored inside a YAML block scalar, contains a `---` sequence on its
own line (e.g., as a separator in TOML comments), the regex will incorrectly truncate
the frontmatter. This will cause the subsequent YAML parsing to fail with a
`SkillLoadError`, preventing the subagent from being loaded and presenting a potentially
confusing error to the user.

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.