Navigate swamp source code to trace error origins, identify execution flows, inspect internal data structures, and understand CLI behavior when --help is insufficient. Use this skill whenever something is broken ("error", "failing", "not working", "crash", "timeout", "bug", "fix", "debug", "troubleshoot", "root cause", "stack trace", "isn't being found", "giving me an error", "slow", "performance", "latency") OR when you need to understand how swamp works internally ("how does", "what happens when", "where is", "internals", "under the hood"). Applies even when the query mentions a specific domain (e.g., "vault expressions aren't resolving" or "how does extension push work") — fetch swamp source to find the answer.
Diagnose and troubleshoot swamp issues, or understand swamp internals, by
fetching and reading the swamp source code. All commands support --json for
machine-readable output.
Verify CLI syntax: If unsure about exact flags or subcommands, run
swamp help source for the complete, up-to-date CLI schema.
| Task | Command |
|---|---|
| Check source status | swamp source path --json |
| Fetch source | swamp source fetch --json |
| Fetch specific ver | swamp source fetch --version v1.0.0 --json |
| Fetch main branch | swamp source fetch --version main --json |
| Clean source | swamp source clean --json |
If swamp <command> --help doesn't fully answer a question about how something
works, fetch the source and read the implementation. Common areas where source
context is needed:
~/.config/swamp/auth.json), API key
format (swamp_ prefix), headless/CI setup — check src/infrastructure/auth/src/cli/commands/extension*.ts and
src/domain/extensions/swamp repo init creates and why — check
src/cli/commands/repo*.ts and src/domain/repo/src/infrastructure/persistence/General rule: When a skill's CLI commands and documentation don't provide
enough detail, use swamp source fetch to get the source and read the relevant
files directly.
When a user reports a swamp issue:
swamp source path --json
Output shape (found):
{
"status": "found",
"version": "20260206.200442.0-sha.abc123",
"path": "/Users/user/.swamp/source",
"fileCount": 245,
"fetchedAt": "2026-02-06T20:04:42.000Z"
}
Output shape (not found):
{
"status": "not_found"
}
If source is missing or the version doesn't match the user's swamp version:
swamp source fetch --json
This fetches source for the current CLI version. To fetch a specific version:
swamp source fetch --version 20260206.200442.0-sha.abc123 --json
Output shape:
{
"status": "fetched",
"version": "20260206.200442.0-sha.abc123",
"path": "/Users/user/.swamp/source",
"fileCount": 245,
"fetchedAt": "2026-02-06T20:04:42.000Z",
"previousVersion": "20260205.100000.0-sha.xyz789"
}
Once source is fetched, read files from ~/.swamp/source/:
Key directories:
src/cli/ - CLI commands and entry pointsrc/domain/ - Domain logic (models, workflows, vaults, etc.)src/infrastructure/ - Infrastructure adapters (persistence, HTTP, etc.)src/presentation/ - Output renderingExample: Read the CLI entry point
Read ~/.swamp/source/src/cli/mod.ts
Example: Read model service
Read ~/.swamp/source/src/domain/models/model_service.ts
If the issue is about slowness, timeouts, or understanding execution flow, enable OpenTelemetry tracing:
# Quick: print spans to stderr
OTEL_TRACES_EXPORTER=console swamp workflow run my-workflow
# Visual: send to local Jaeger (docker run -p 16686:16686 -p 4318:4318 jaegertracing/all-in-one)
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 swamp workflow run my-workflow
Traces show the full execution hierarchy with timing for every operation — CLI command → workflow → job → step → method → driver. See references/tracing.md for setup, span names, and diagnosing common issues.
Based on the error message or symptoms:
src/cli/commands/{command}.tssrc/domain/models/src/domain/workflows/src/domain/vaults/src/infrastructure/persistence/src/presentation/output/After diagnosing:
~/.swamp/source/
├── src/
│ ├── cli/
│ │ ├── commands/ # CLI command implementations
│ │ ├── context.ts # Command context and options
│ │ └── mod.ts # CLI entry point
│ ├── domain/
│ │ ├── errors.ts # User-facing errors
│ │ ├── models/ # Model types and services
│ │ ├── workflows/ # Workflow execution
│ │ ├── vaults/ # Secret management
│ │ ├── data/ # Data lifecycle
│ │ └── events/ # Domain events
│ ├── infrastructure/
│ │ ├── persistence/ # File-based storage
│ │ ├── logging/ # LogTape configuration
│ │ ├── tracing/ # OpenTelemetry tracing
│ │ └── update/ # Self-update mechanism
│ └── presentation/
│ └── output/ # Terminal output rendering
├── integration/ # Integration tests
├── design/ # Design documents
└── deno.json # Deno configuration
When done troubleshooting:
swamp source clean --json
Output shape:
{
"status": "cleaned",
"path": "/Users/user/.swamp/source"
}
swamp source fetch downloads source matching the current CLI
version--version main to get the latest unreleased code--version <tag> to get a specific releaseIf a source extension isn't appearing in swamp model type search:
swamp extension source list — look for
green checkmark. Red cross means the path doesn't exist.extensions/models/ (or the appropriate type directory).deno.json: Source extensions need a deno.json with
dependency mappings (e.g., "zod": "npm:zod@4"). Without it, bundling fails
with "Import "zod" not a dependency"."Using discovered deno config"
warnings — this confirms the bundler found the source's config file.only filter: If the source was added with --only vaults,
model types won't load from it.The source loading code lives in:
src/infrastructure/persistence/swamp_sources_repository.ts — file reading
and path resolutionsrc/cli/mod.ts — wiring sources into the loader pipeline| Need | Use Skill |
|---|---|
| Run/create models | swamp-model |
| Run/create workflows | swamp-workflow |
| Manage secrets | swamp-vault |
| Manage repository | swamp-repo |
| Create extension models | swamp-extension-model |