feat(repo): custom agent tool definitions via swamp agent setup#1400
Draft
stack72 wants to merge 1 commit into
Draft
feat(repo): custom agent tool definitions via swamp agent setup#1400stack72 wants to merge 1 commit into
stack72 wants to merge 1 commit into
Conversation
Allow users to define custom AI agent tools without code changes. Custom tools get the same skills + instructions + gitignore scaffolding as built-in tools, stored in `.swamp-custom-tools.yaml` at the repo root. The `swamp agent setup` interactive wizard scans an existing repo for config patterns (e.g. `.windsurf/rules/`, `AGENTS.md`) and offers informed choices. `swamp agent list` and `swamp agent rm` manage definitions. `swamp repo init --tool <custom-name>` works once defined. Built-in tools retain their full integration (audit hooks, harness detection, doctor checks). Custom tools skip these subsystems — when a tool gains enough traction it can be promoted to built-in with proper hook normalization. Type system: AiTool union stays closed for built-in exhaustiveness checks. Boundary types (marker, init/upgrade options, results) widened to string[] so custom names flow through. ToolConfig value object unifies both at the scaffolding layer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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.
Summary
swamp agent setupinteractive wizard for defining custom AI agent tools.swamp-custom-tools.yamlat repo rootswamp repo init --tool <custom-name>works once definedHow it works
swamp agent setupasks the tool name, optionally scans an existing repo for config patterns (.windsurf/rules/,AGENTS.md, etc.), then asks where the tool reads instructions from.<name>/skills/, instructions mode (shared vs owned) from the file location.swamp-custom-tools.yaml— committable, copyable between reposswamp repo init --tool <name>resolves custom tools viaToolResolver, copies skills, generates instructionsArchitecture
ToolConfigvalue object unifies built-in and custom tools at the scaffolding layerAiToolunion stays closed for built-in exhaustiveness checksRepoMarkerData.tools, init/upgrade options/results) widened tostring[]ToolResolverchecks built-in tools first (O(1)), then custom-tools.yaml (lazy-loaded)ToolResolveraccepts an injectedCustomToolLoaderto avoid domain→infrastructure importNew files
src/domain/repo/custom_tool.ts— types, factories, validation, detection, defaults derivationsrc/domain/repo/tool_resolver.ts— resolution layer (built-in + custom)src/infrastructure/persistence/custom_tools_repository.ts— YAML persistencesrc/cli/commands/agent_setup.ts—swamp agent setup/list/rmcommandsEcosystem research
Researched 12 AI coding tools (Windsurf, Zed, Amp, Aider, Cline, Roo Code, Kilo Code, Trae, Augment, Tabnine, PearAI, Pi). AGENTS.md is converging as the cross-tool standard. Most tools use
.<toolname>/rules/for config. Skills at.<toolname>/skills/works for tools with native support (Pi, Kilo) and via instructions references for others.Test plan
deno checkpassesdeno lintclean on new filesdeno fmtapplieddeno run test— 6007 passed, 0 faileddeno run compile— binary compilesswamp agent setup→ define custom tool →swamp repo init --tool <name>→ verify scaffoldingswamp agent list/swamp agent rmswamp repo init --tool nonexistent→ helpful error🤖 Generated with Claude Code