Skip to content

feat(repo): custom agent tool definitions via swamp agent setup#1400

Draft
stack72 wants to merge 1 commit into
mainfrom
worktree-tooling-discovery
Draft

feat(repo): custom agent tool definitions via swamp agent setup#1400
stack72 wants to merge 1 commit into
mainfrom
worktree-tooling-discovery

Conversation

@stack72
Copy link
Copy Markdown
Contributor

@stack72 stack72 commented May 18, 2026

Summary

  • Adds swamp agent setup interactive wizard for defining custom AI agent tools
  • Custom tools get skills + instructions + gitignore scaffolding, stored in .swamp-custom-tools.yaml at repo root
  • swamp repo init --tool <custom-name> works once defined
  • Built-in tools (claude, cursor, kiro, etc.) retain full audit/hooks/doctor integration
  • Custom tools skip audit subsystems — promoted to built-in when adoption warrants

How it works

  1. swamp agent setup asks the tool name, optionally scans an existing repo for config patterns (.windsurf/rules/, AGENTS.md, etc.), then asks where the tool reads instructions from
  2. Defaults are derived: skills go to .<name>/skills/, instructions mode (shared vs owned) from the file location
  3. Definition saved to .swamp-custom-tools.yaml — committable, copyable between repos
  4. swamp repo init --tool <name> resolves custom tools via ToolResolver, copies skills, generates instructions

Architecture

  • ToolConfig value object unifies built-in and custom tools at the scaffolding layer
  • AiTool union stays closed for built-in exhaustiveness checks
  • Boundary types (RepoMarkerData.tools, init/upgrade options/results) widened to string[]
  • ToolResolver checks built-in tools first (O(1)), then custom-tools.yaml (lazy-loaded)
  • DDD: ToolResolver accepts an injected CustomToolLoader to avoid domain→infrastructure import

New files

  • src/domain/repo/custom_tool.ts — types, factories, validation, detection, defaults derivation
  • src/domain/repo/tool_resolver.ts — resolution layer (built-in + custom)
  • src/infrastructure/persistence/custom_tools_repository.ts — YAML persistence
  • src/cli/commands/agent_setup.tsswamp agent setup/list/rm commands
  • Tests for all new modules (41 tests)

Ecosystem 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 check passes
  • deno lint clean on new files
  • deno fmt applied
  • deno run test — 6007 passed, 0 failed
  • deno run compile — binary compiles
  • Manual: swamp agent setup → define custom tool → swamp repo init --tool <name> → verify scaffolding
  • Manual: swamp agent list / swamp agent rm
  • Manual: swamp repo init --tool nonexistent → helpful error

🤖 Generated with Claude Code

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>
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