Skip to content

Add git-backed builtin skill registry - #41

Merged
trotsky1997 merged 3 commits into
mainfrom
agent/builtin-skill-registry
Jun 2, 2026
Merged

Add git-backed builtin skill registry#41
trotsky1997 merged 3 commits into
mainfrom
agent/builtin-skill-registry

Conversation

@trotsky1997

@trotsky1997 trotsky1997 commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a PRD for builtin skill registry lifecycle and npx skills adapter behavior
  • add skill provenance, deterministic resolution, builtin review skill fallback, and git-backed local registry loading with HEAD revision provenance
  • require the local registry path to be a clean git worktree root; dirty/untracked registry content is skipped so HEAD provenance matches loaded skills
  • add global Codex skill discovery for ~/.codex/skills/**/SKILL.md
  • add ra skills ... passthrough to npx --yes skills@1.5.9, defaulting add to --agent codex unless an agent/all option is present
  • update config schema, example config, init template, and discovery tests

Testing

  • cargo fmt --check
  • git diff --check
  • node -e "JSON.parse(require('fs').readFileSync('spec/ra-config.schema.json','utf8'))"

Could not run local cargo tests or regenerate schema locally because Cargo repeatedly stalled fetching the optional opentui_rust git dependency. timeout 180 cargo test --test skills_discover exited with 124 while updating that dependency.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @trotsky1997, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36904a87a9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/skills.rs
Comment on lines +530 to +534
let output = std::process::Command::new("git")
.arg("-C")
.arg(root)
.arg("rev-parse")
.arg("HEAD")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject registry paths inside unrelated worktrees

When skills.registry.path points at a normal subdirectory of some other Git worktree, git -C <path> rev-parse HEAD still succeeds and returns the enclosing repository's commit. That means Ra will load a directory that is not itself a git-backed skill registry and attach misleading provenance, despite the config contract saying unversioned registries are skipped; verify the configured root is the Git toplevel/gitdir before accepting the revision.

Useful? React with 👍 / 👎.

Comment thread src/skills.rs
.to_string_lossy()
.into_owned(),
];
load_skills_with_source(&patterns, SkillSource::Registry, Some(revision))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require clean registry content before stamping HEAD

For a dirty registry checkout, this stamps every skill with the current HEAD but then reads SKILL.md files directly from the working tree. If a skill is uncommitted, modified, or untracked, Ra exposes content that cannot be reproduced from the recorded revision, which defeats the new provenance guarantee; either reject dirty registries or read the skill blobs from the recorded commit.

Useful? React with 👍 / 👎.

Comment thread src/skills.rs
Comment on lines +431 to +432
let path = materialize_builtin_skill(name, raw)
.unwrap_or_else(|| PathBuf::from(format!("<builtin>/skills/{name}/SKILL.md")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid advertising unreadable builtin paths

If the cache directory is unavailable or unwritable, this fallback still loads the builtin skill but advertises a pseudo path like <builtin>/skills/review/SKILL.md in the model-facing catalog. The read tool only reads filesystem paths, so in cache-restricted environments the model cannot follow the prompt's instruction to load the full builtin skill before acting; keep a readable materialized path or suppress the catalog entry when materialization fails.

Useful? React with 👍 / 👎.

Comment thread src/main.rs
fn skills_args_have_agent(args: &[String]) -> bool {
let mut iter = args.iter();
while let Some(arg) = iter.next() {
if arg == "-a" || arg == "--agent" || arg == "--all" || arg.starts_with("--agent=") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Still default --all installs to Codex

When users run ra skills add <repo> --all, --all selects all skills from the package, not an agent target, so skipping the injected --agent codex means whole-collection installs fall back to the upstream CLI's default or interactive agent choice instead of Ra's discovered Codex/project path. Only treat actual agent-target flags as satisfying this check.

Useful? React with 👍 / 👎.

@trotsky1997
trotsky1997 merged commit 976731c into main Jun 2, 2026
6 checks passed
@trotsky1997
trotsky1997 deleted the agent/builtin-skill-registry branch June 2, 2026 11:05
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.

1 participant