feat: ship Agent Foundry as a Claude Code plugin #270
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/agent-foundry!270
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/claude-code-plugin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Agent Foundry reaches Claude Code only through adoption: each repository holds a copy of
AGENTS.md,.agents/, and.claude/, and every newer source needs afoundry-upgradein each one. #269 gave OpenCode a folder it loads from outside the repository. This does the same for Claude Code, as a plugin installed once per user that updates withclaude plugin update. Codex stays for a work of its own.Refs #268
What changed
scripts/build-form.sh claude <commit> <folder>builds a folder that is itself a marketplace,dumbledore, holding one plugin,dumbledore. The plugin holds the shared part, byte for byte the same as OpenCode's form, the subagent adapters, and hooks wiring the main-checkout guard and the shell check. Itsversionis the source commit, so each build is an update.A plugin carries no
CLAUDE.md, so SessionStart hooks hand the policy over as added context. Claude Code caps each hook's context at 10,000 characters, and the built policy is about 18,500. The build therefore cuts it at its##headings into parts, three today, each with its own hook and an opening line saying "Part n of m", so the model can put them back in order. The last part adds where the plugin sits, known only at run time, and that Claude Code lists the skills and subagents the policy names by their bare names asdumbledore:<name>. Claude Code reads the project's ownAGENTS.mditself, and the policy already has the session readAGENTS.local.md.A plugin cannot carry settings, so the build also writes
settings/dumbledore.json, which the operator merges into~/.claude/settings.json. It holds the source's denied tools,Readrules, edits that ask first, and the features it turns off, without the source's sandbox.scripts/publish-form.shcommits the build to the branchclaude-pluginwhen it changes, without force. It refuses to put an older build over a newer one. Apublishjob in the Maintenance workflow runs it after the checks pass on each push tomain, using the forge's automatic token. Operators add the marketplace as<repository URL>#claude-plugin. The section "Plugin for Claude Code" ofdocs/INSTALL.mdgives the install, update, and checks.How to verify
Needs Claude Code 2.1.277 or later,
jq, and this branch checked out. Branch tip1e6bc53, basemainat249629c.Build and validate the build:
It exits 0, with warnings for no author, README, or icon. On
main, theclaudetarget exits 2 with the usage line.In a scratch repository holding only a README and a git-ignored
AGENTS.local.mdwith a Test command, run:The answer starts "Material decisions, such as product, architecture, and stack choices".
Run on 2026-12-02 with Claude Code 2.1.334 and Sonnet 5.5, these scenarios gave the expected results:
/compact;foundry-upgradenot among them, andimplement-featurethen loadeddumbledore:run-changefrom its bare name;agent-foundry/templates/handoff.mdto the plugin's path;echo $1in a worktree showed ShellCheck's SC2086;AGENTS.local.md.Publish to a local bare repository, serve it over HTTP, then add, install, publish a later commit, and update. Claude Code refuses
file://as a marketplace source, hence HTTP. In a scratchCLAUDE_CONFIG_DIR, this moved the plugin from the earlier commit to the later one. Doing the same with a local build folder rebuilt in place also updated it.Checks on the tip:
tests/verify-agent-config.sh412 passed, with the new areasbuild-form.sh(42) andpublish-form.sh(8);tests/check-work-folder.sh46; ShellCheck clean; prettier; the static validator; andgit diff --check main. Each new test fails onmain, at theclaudetarget name or at the publishing script the branch adds.Considerations
publishjob has not run on the forge yet. Its first push tomainafter the merge shows whether the automatic token can pushclaude-plugin. Forgejo's documentation says the token can push for a push event.run-sandboxed.shcould not match an installed path, because Claude Code does not expand~inexcludedCommands. Whether the sandbox stays at all is open.jqis absent, starts the session without it; the opening line asks the model to tell the user.~/.clauderather than a customCLAUDE_CONFIG_DIR, and the context text's sentence thatAGENTS.mdnames the policy, inherited from the OpenCode form.https://claude.ai/code/session_012wUN2eKSj9s2vRHJdFPNk3
Command failed
The agent did not complete this command, so nothing came of it. A person should look at this thread.
The run failed at step "aoe_purge". The operator reads the job logs in the Windmill editor, or finds the run with:
wmill job list --path f/agents/bot_commands