Skip to content

feat: first-class agents.toml / dotagents skill support #735

Closed

Description

@dcramer

Summary

Add native agents.toml support so any junior-prod install can declare external skill sources using the standard dotagents format. Junior fetches and materializes those skills at deploy time; existing skill discovery picks them up without further configuration.


Background

dotagents (@sentry/dotagents) is a tool Sentry maintains that reads agents.toml and fetches SKILL.md directories from GitHub, GitLab, or well-known HTTPS sources. It's the canonical way to declare and share skills across agent tools (Claude, Cursor, Codex, etc.).

Junior already has a layered skill discovery system (app/skills/, plugins, SKILL_DIRS). This feature adds agents.toml as a first-class source in that system — no plugins to install, no manual build steps.


Design

Config location

app/agents.toml — standard dotagents TOML format, no YAML variant. Junior invokes dotagents with cwd = homeDir().

version = 1

[trust]
github_orgs = ["getsentry"]

[[skills]]
name = "find-bugs"
source = "getsentry/skills"

[[skills]]
name = "commit"
source = "getsentry/[email protected]"   # pin ref for reproducibility

Managed directory

Materialized skills land in app/.agents/skills/ (dotagents default). This is gitignored and dotagents-managed. It is separate from app/skills/ (user/plugin-authored) to keep ownership clear.

Skill root ordering (deterministic)

  1. additionalRoots (explicit)
  2. SKILL_DIRS env
  3. app/skills/ (user-authored)
  4. Plugin roots
  5. app/.agents/skills/ (dotagents-managed)

Duplicate skill names: first discovery wins (existing behavior). Collisions across roots should be logged as a warning.

Lifecycle: when does sync happen?

At deploy time via the snapshot pre-step:

// cli/snapshot-warmup.ts
export async function runSnapshotCreate(log) {
  await maybeSyncAgentsToml({ log, cwd: homeDir(), required: true });
  // ... existing snapshot code
}

Explicitly via a new CLI command:

node cli.js agents-sync

NOT lazily during discoverSkills() — skills must exist on the host before request time; fetching on the skill discovery path would block prompt construction.

NOT automatically during server startup in production by default. If agents.toml exists but app/.agents/skills/ is missing, log a clear actionable warning.

Dependency

@sentry/dotagents added to dependencies of @sentry/junior (not npx). Junior invokes the installed binary, not a global command.

Error handling

  • Snapshot step: if agents.toml exists and dotagents install fails → fail the snapshot command (declared skills are part of app behavior)
  • Runtime discovery: if agents.toml exists but .agents/skills/ is absent → warn, continue without dotagents skills (don't crash a live deployment over a missing generated directory)

Security considerations

  • Document that production installs should use [trust] and pin refs — moving refs are not reproducible across deploys
  • Log installed skill names and their sources after sync
  • Run non-interactively
  • No network access at request time

Pre-implementation verification needed

Before coding, confirm:

  1. Does @sentry/dotagents expose a stable programmatic API, or is CLI-only the contract? Shell-out is fine, but we need the right invocation flags.
  2. Does dotagents install have a skills-only mode? Running under app/ may generate MCP/hook/subagent configs for other tools (Claude, Cursor, etc.) that we don't need and shouldn't create.
  3. Does the deployment pipeline always run node cli.js snapshot? If not, snapshot-only sync is insufficient.
  4. Is homeDir() / app/ writable during snapshot execution? Verify that app/.agents/skills/ can be created at that lifecycle point.
  5. Current duplicate skill behavior — confirm whether later-discovered roots can overwrite earlier ones; locking down the ordering is required.

Acceptance criteria

  • Fresh deploy with app/agents.toml → dotagents skills appear in <available-skills> with no extra config
  • loadSkill can load a dotagents-materialized skill from the sandbox copy
  • node cli.js agents-sync works standalone (safe to re-run)
  • Snapshot step fails with a clear error if agents.toml exists and install fails
  • No agents.toml → zero behavioral change
  • Duplicate skill names across roots are deterministic and logged
  • app/.agents/ gitignore guidance in docs
  • Trust + ref-pinning best practices documented
  • Tests: snapshot wiring, CLI sync, root inclusion, missing agents.toml no-op, collision logging

--

View Junior Session in Sentry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions