ad-sdl/madsci/madsci-cli
Claude Code and agent skill by ad-sdl/madsci
- community
Checking that the SKILL.md file is still in the repository.
Working with the MADSci CLI (the `madsci` command). Use when adding, modifying, or debugging CLI commands, or when using the CLI to operate a MADSci lab.
Install
npx vskill@latest install ad-sdl/madsci/madsci-cliSKILL.md
MADSci CLI
The madsci CLI is built on Click with lazy command loading, Rich output formatting, and a Textual TUI. It provides 26 commands for managing MADSci labs.
Reference Files
Detailed material is in reference/. Read the relevant file when the task touches that area:
- Command Reference — every command's flags, subcommands, and behavior. See reference/commands.md.
- Template System — manifest format, categories, Jinja2 filters, Pydantic alignment. See reference/templates.md.
Key Files
| File | Purpose | |
|---|---|---|
src/madsci_client/madsci/client/cli/__init__.py | Root command, AliasedGroup, _LAZY_COMMANDS | |
src/madsci_client/madsci/client/cli/commands/ | 26 command modules | |
src/madsci_client/madsci/client/cli/utils/output.py | Rich console output helpers | |
src/madsci_client/madsci/client/cli/tui/app.py | Textual TUI application | |
src/madsci_client/madsci/client/cli/tui/styles/theme.tcss | TUI CSS theme | |
src/madsci_common/madsci/common/bundled_templates/ | 33 template manifests + Jinja2 files |
Architecture
Lazy Command Loading
Commands are loaded on first use to minimize CLI startup time:
AliasedGroup
Resolves aliases first, then tries eager commands, then lazy-imports.
Adding a New Command
Step 1: Create the command module
Step 2: Register in _LAZY_COMMANDS
Step 3: (Optional) Add alias
Critical rules:
- Lazy imports are mandatory for heavy dependencies (clients, types, etc.) - import inside the function body, not at module top
- Use
@click.pass_contextto access the CLI context (console, verbosity, etc.) - All informational output should support
--jsonviactx.obj["json"]
Output Helpers
Start/Stop Lifecycle
Docker Mode (default)
Local Mode (no Docker)
Individual Services
PID Tracking
- PIDs stored in
.madsci/pids/{name}.pid(JSON:{pid, exe, name}) - Logs stored in
.madsci/logs/{name}_TIMESTAMP.log - Process identity verified to prevent PID reuse
- Stop sends SIGTERM, waits 5s for exit
Health Polling (-d with --wait)
After detached start, polls /health on each service every 2s (timeout: 60s). Displays live Rich table with status.
TUI Application
9 main screens + 5 detail/modal screens built with Textual:
| Screen | Key | Description | |
|---|---|---|---|
| Dashboard | d | Service overview, quick actions, recent events | |
| Status | s | Detailed health with infrastructure checks | |
| Logs | l | Log viewer with filtering and follow mode | |
| Nodes | n | Node registry with status and actions | |
| Workflows | w | Workflow history and details | |
| Experiments | e | Experiment listing with search/filter and detail panels | |
| Resources | i | Resource inventory with search/filter and detail panels | |
| Data Browser | b | Data capture browsing and querying | |
| Locations | o | Location management with resource attachments |
- Auto-refresh every 5 seconds
- CSS theming in
tui/styles/theme.tcss - Trogon integration via
Ctrl+P
Testing CLI Commands
Use Click's CliRunner:
Smoke test pattern: Verify all 26 commands parse without import errors:
Common Pitfalls
- Lazy imports mandatory: Heavy deps (clients, types, managers) must be imported inside function bodies, not at module top. Startup time is critical.
- `_LazyMadsciContext`: The context object is lazy; it only initializes
MadsciContextwhen attributes are first accessed. Don't force early initialization. - yarn, not npm: UI directory uses
yarnfor Node.js package management - Compose file discovery:
startsearches forcompose.yaml,compose.yml,docker-compose.yaml,docker-compose.ymlin current and parent directories - ULID not UUID: Use
new_ulid_str()for any IDs - AnyUrl trailing slash: All URLs stored via Pydantic AnyUrl get a trailing slash
- JSON output: All informational commands should support
--jsonoutput mode - Click groups vs commands:
startandstopare Click groups withmanager/nodesubcommands - Trogon patch: The
commandscommand patches Trogon's_apply_default_valuefor ClickSentinel.UNSETcompatibility
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/madsci_common/madsci/common/bundled_templates/_skills/madsci-cli/SKILL.md
Popularity
- Repository stars
- 82
- Repository forks
- 11
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ad-sdl/madsci/madsci-cli)