System Definition Generator
Generate a system definition file that catalogs available commands for the ToolSmith agent. This file describes the local operating system and provides a verified catalog of commands the ToolSmith can use to create tools.
Arguments
--categories <list> - Comma-separated categories to test: file-ops, text-processing, hashing, compression, network, process, json (default: all)
--output <path> - Output file path (default: .aiwg/smiths/system-definition.yaml)
--verify-only - Verify existing definition without regenerating
--update - Update existing definition with any new commands
Workflow
Step 1: Ensure Directory Structure
Create the smiths directory if it doesn't exist:
mkdir -p .aiwg/smiths/toolsmith/tools
mkdir -p .aiwg/smiths/toolsmith/scripts
Step 2: Probe System Information
Gather platform details:
# OS and kernel
uname -s # OS name (Linux, Darwin)
uname -r # Kernel version
uname -m # Architecture (x86_64, arm64)
# Distribution (Linux)
cat /etc/os-release 2>/dev/null | grep -E "^(NAME|VERSION)="
# macOS version
sw_vers 2>/dev/null
# Shell
echo $SHELL
$SHELL --version 2>/dev/null | head -1
# User environment
echo $HOME
echo $PATH | tr ':' '\n' | head -5
Step 3: Define Command Categories
Test commands in each category. For each command:
- Check if it exists:
command -v <cmd> or which <cmd>
- Get version if available:
<cmd> --version 2>/dev/null | head -1
- Note capabilities based on common usage patterns
file-ops - File system operations:
- find, ls, cp, mv, rm, mkdir, rmdir, chmod, chown, stat, file, ln, touch, du, df
text-processing - Text manipulation:
- grep, sed, awk, sort, uniq, cut, tr, head, tail, wc, diff, comm, join, paste, column
hashing - Checksums and hashing:
- md5sum (or md5 on macOS), sha256sum (or shasum -a 256), sha1sum, cksum
compression - Archive and compression:
- gzip, gunzip, tar, zip, unzip, bzip2, xz
network - Network utilities:
- curl, wget, nc (netcat), ping, dig, host, ssh, scp, rsync
process - Process management:
- ps, kill, pkill, pgrep, top, nice, nohup, xargs
json - JSON processing:
Step 4: Test Each Command
For each command in the selected categories:
# Check existence
if command -v <cmd> >/dev/null 2>&1; then
# Get path
CMD_PATH=$(command -v <cmd>)
# Get version (various methods)
VERSION=$(<cmd> --version 2>/dev/null | head -1 || <cmd> -V 2>/dev/null | head -1 || echo "unknown")
# Mark as tested=true
fi
Step 5: Generate YAML Output
Create .aiwg/smiths/system-definition.yaml:
# System Definition for ToolSmith
# Generated: <timestamp>
# Platform: <os> <version>
platform:
os: "<linux|darwin|windows>"
distribution: "<Ubuntu 22.04|macOS 14.0|etc>"
kernel: "<kernel version>"
shell: "<shell path>"
shell_version: "<shell version>"
architecture: "<x86_64|arm64|etc>"
environment:
home: "<home directory>"
path_dirs:
- /usr/local/bin
- /usr/bin
- /bin
temp_dir: "/tmp"
categories:
file-ops:
description: "File system operations"
commands:
- name: find
path: /usr/bin/find
version: "4.8.0"
tested: true
capabilities:
- recursive search
- pattern matching
- exec actions
- time filters
# ... more commands
text-processing:
description: "Text manipulation tools"
commands:
# ... commands
# ... more categories
Step 6: Report Summary
Output a summary of tested commands:
System Definition Generated
============================
Platform: Ubuntu 22.04 (Linux 5.15)
Shell: /bin/bash 5.1.16
Architecture: x86_64
Categories tested:
file-ops: 15/15 commands available
text-processing: 15/15 commands available
hashing: 4/4 commands available
compression: 5/7 commands available (missing: xz, bzip2)
network: 7/9 commands available (missing: nc, dig)
process: 8/8 commands available
json: 1/1 commands available
Total: 55/59 commands verified
Output: .aiwg/smiths/system-definition.yaml
Command Capability Mappings
Map each command to its key capabilities for catalog matching:
file-ops
| Command |
Capabilities |
| find |
recursive search, pattern matching, exec actions, time/size filters |
| ls |
directory listing, detailed output, sorting, hidden files |
| cp |
copy files, recursive copy, preserve attributes |
| mv |
move/rename files, force overwrite |
| rm |
remove files, recursive delete, force delete |
| mkdir |
create directories, create parents |
| chmod |
change permissions, recursive |
| chown |
change ownership |
| stat |
file metadata, timestamps |
| file |
file type detection |
| ln |
symbolic links, hard links |
| touch |
create files, update timestamps |
| du |
disk usage, summarize |
| df |
filesystem space |
text-processing
| Command |
Capabilities |
| grep |
pattern matching, regex, recursive, context lines |
| sed |
stream editing, substitution, in-place edit |
| awk |
field processing, calculations, pattern-action |
| sort |
sorting, numeric sort, reverse, unique |
| uniq |
deduplicate, count occurrences |
| cut |
extract columns, delimiter-based |
| tr |
character translation, delete |
| head |
first N lines |
| tail |
last N lines, follow |
| wc |
line/word/char count |
| diff |
compare files, unified diff |
| comm |
compare sorted files |
hashing
| Command |
Capabilities |
| md5sum |
MD5 checksums |
| sha256sum |
SHA-256 checksums |
| sha1sum |
SHA-1 checksums |
compression
| Command |
Capabilities |
| gzip |
gzip compression/decompression |
| tar |
archive creation/extraction, compression integration |
| zip |
zip archive creation |
| unzip |
zip extraction |
network
| Command |
Capabilities |
| curl |
HTTP requests, downloads, headers, POST data |
| wget |
file downloads, recursive, resume |
| ping |
connectivity testing |
| ssh |
remote execution |
| rsync |
efficient file sync, incremental |
process
| Command |
Capabilities |
| ps |
process listing, detailed info |
| kill |
send signals |
| pkill |
kill by name |
| pgrep |
find processes by name |
| xargs |
build commands from input |
json
| Command |
Capabilities |
| jq |
JSON parsing, filtering, transformation |
Verify-Only Mode
When --verify-only is specified:
- Read existing
.aiwg/smiths/system-definition.yaml
- Re-test all listed commands
- Report any commands that no longer work
- Do NOT modify the file
Verifying system definition...
file-ops: 15/15 commands OK
text-processing: 15/15 commands OK
hashing: 4/4 commands OK
compression: 5/5 commands OK
network: 6/7 commands CHANGED
- nc: was available, now missing
process: 8/8 commands OK
json: 1/1 commands OK
Verification complete. 1 command changed.
Run with --update to fix system definition.
Update Mode
When --update is specified:
- Read existing system definition
- Re-test all commands
- Add any new commands found
- Remove commands no longer available
- Update timestamps
- Preserve user customizations (if any)
Usage Examples
# Generate full system definition
/smith-sysdef
# Test only specific categories
/smith-sysdef --categories file-ops,text-processing
# Custom output location
/smith-sysdef --output ./custom-sysdef.yaml
# Verify existing definition
/smith-sysdef --verify-only
# Update definition with changes
/smith-sysdef --update
Error Handling
No commands available in category:
Warning: Category 'json' has no available commands.
- jq: not found
Consider installing: apt install jq (Debian/Ubuntu) or brew install jq (macOS)
Permission issues:
Warning: Some commands may require elevated permissions:
- chown: requires root for ownership changes
- kill: may require root for other users' processes
Success Criteria
References
- ToolSmith agent:
@$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/agents/toolsmith-dynamic.md
- Tool catalog:
.aiwg/smiths/toolsmith/catalog.yaml
1---2namespace: aiwg3name: smith-sysdef4platforms: [all]5description: Generate system definition file for ToolSmith with tested OS commands6commandHint:7 argumentHint: '[--categories <list>] [--output <path>] [--verify-only] [--update --interactive --guidance "text"]'8 allowedTools: 'Bash, Read, Write, Glob'9 model: haiku10 category: smithing11 modelRole: efficiency12 modelTier: economy13---1415# System Definition Generator1617Generate a system definition file that catalogs available commands for the ToolSmith agent. This file describes the local operating system and provides a verified catalog of commands the ToolSmith can use to create tools.1819## Arguments2021- `--categories <list>` - Comma-separated categories to test: file-ops, text-processing, hashing, compression, network, process, json (default: all)22- `--output <path>` - Output file path (default: `.aiwg/smiths/system-definition.yaml`)23- `--verify-only` - Verify existing definition without regenerating24- `--update` - Update existing definition with any new commands2526## Workflow2728### Step 1: Ensure Directory Structure2930Create the smiths directory if it doesn't exist:3132```bash33mkdir -p .aiwg/smiths/toolsmith/tools34mkdir -p .aiwg/smiths/toolsmith/scripts35```3637### Step 2: Probe System Information3839Gather platform details:4041```bash42# OS and kernel43uname -s # OS name (Linux, Darwin)44uname -r # Kernel version45uname -m # Architecture (x86_64, arm64)4647# Distribution (Linux)48cat /etc/os-release 2>/dev/null | grep -E "^(NAME|VERSION)="4950# macOS version51sw_vers 2>/dev/null5253# Shell54echo $SHELL55$SHELL --version 2>/dev/null | head -15657# User environment58echo $HOME59echo $PATH | tr ':' '\n' | head -560```6162### Step 3: Define Command Categories6364Test commands in each category. For each command:651. Check if it exists: `command -v <cmd>` or `which <cmd>`662. Get version if available: `<cmd> --version 2>/dev/null | head -1`673. Note capabilities based on common usage patterns6869**file-ops** - File system operations:70- find, ls, cp, mv, rm, mkdir, rmdir, chmod, chown, stat, file, ln, touch, du, df7172**text-processing** - Text manipulation:73- grep, sed, awk, sort, uniq, cut, tr, head, tail, wc, diff, comm, join, paste, column7475**hashing** - Checksums and hashing:76- md5sum (or md5 on macOS), sha256sum (or shasum -a 256), sha1sum, cksum7778**compression** - Archive and compression:79- gzip, gunzip, tar, zip, unzip, bzip2, xz8081**network** - Network utilities:82- curl, wget, nc (netcat), ping, dig, host, ssh, scp, rsync8384**process** - Process management:85- ps, kill, pkill, pgrep, top, nice, nohup, xargs8687**json** - JSON processing:88- jq8990### Step 4: Test Each Command9192For each command in the selected categories:9394```bash95# Check existence96if command -v <cmd> >/dev/null 2>&1; then97 # Get path98 CMD_PATH=$(command -v <cmd>)99100 # Get version (various methods)101 VERSION=$(<cmd> --version 2>/dev/null | head -1 || <cmd> -V 2>/dev/null | head -1 || echo "unknown")102103 # Mark as tested=true104fi105```106107### Step 5: Generate YAML Output108109Create `.aiwg/smiths/system-definition.yaml`:110111```yaml112# System Definition for ToolSmith113# Generated: <timestamp>114# Platform: <os> <version>115116platform:117 os: "<linux|darwin|windows>"118 distribution: "<Ubuntu 22.04|macOS 14.0|etc>"119 kernel: "<kernel version>"120 shell: "<shell path>"121 shell_version: "<shell version>"122 architecture: "<x86_64|arm64|etc>"123124environment:125 home: "<home directory>"126 path_dirs:127 - /usr/local/bin128 - /usr/bin129 - /bin130 temp_dir: "/tmp"131132categories:133 file-ops:134 description: "File system operations"135 commands:136 - name: find137 path: /usr/bin/find138 version: "4.8.0"139 tested: true140 capabilities:141 - recursive search142 - pattern matching143 - exec actions144 - time filters145 # ... more commands146147 text-processing:148 description: "Text manipulation tools"149 commands:150 # ... commands151152 # ... more categories153```154155### Step 6: Report Summary156157Output a summary of tested commands:158159```160System Definition Generated161============================162Platform: Ubuntu 22.04 (Linux 5.15)163Shell: /bin/bash 5.1.16164Architecture: x86_64165166Categories tested:167 file-ops: 15/15 commands available168 text-processing: 15/15 commands available169 hashing: 4/4 commands available170 compression: 5/7 commands available (missing: xz, bzip2)171 network: 7/9 commands available (missing: nc, dig)172 process: 8/8 commands available173 json: 1/1 commands available174175Total: 55/59 commands verified176177Output: .aiwg/smiths/system-definition.yaml178```179180## Command Capability Mappings181182Map each command to its key capabilities for catalog matching:183184### file-ops185| Command | Capabilities |186|---------|-------------|187| find | recursive search, pattern matching, exec actions, time/size filters |188| ls | directory listing, detailed output, sorting, hidden files |189| cp | copy files, recursive copy, preserve attributes |190| mv | move/rename files, force overwrite |191| rm | remove files, recursive delete, force delete |192| mkdir | create directories, create parents |193| chmod | change permissions, recursive |194| chown | change ownership |195| stat | file metadata, timestamps |196| file | file type detection |197| ln | symbolic links, hard links |198| touch | create files, update timestamps |199| du | disk usage, summarize |200| df | filesystem space |201202### text-processing203| Command | Capabilities |204|---------|-------------|205| grep | pattern matching, regex, recursive, context lines |206| sed | stream editing, substitution, in-place edit |207| awk | field processing, calculations, pattern-action |208| sort | sorting, numeric sort, reverse, unique |209| uniq | deduplicate, count occurrences |210| cut | extract columns, delimiter-based |211| tr | character translation, delete |212| head | first N lines |213| tail | last N lines, follow |214| wc | line/word/char count |215| diff | compare files, unified diff |216| comm | compare sorted files |217218### hashing219| Command | Capabilities |220|---------|-------------|221| md5sum | MD5 checksums |222| sha256sum | SHA-256 checksums |223| sha1sum | SHA-1 checksums |224225### compression226| Command | Capabilities |227|---------|-------------|228| gzip | gzip compression/decompression |229| tar | archive creation/extraction, compression integration |230| zip | zip archive creation |231| unzip | zip extraction |232233### network234| Command | Capabilities |235|---------|-------------|236| curl | HTTP requests, downloads, headers, POST data |237| wget | file downloads, recursive, resume |238| ping | connectivity testing |239| ssh | remote execution |240| rsync | efficient file sync, incremental |241242### process243| Command | Capabilities |244|---------|-------------|245| ps | process listing, detailed info |246| kill | send signals |247| pkill | kill by name |248| pgrep | find processes by name |249| xargs | build commands from input |250251### json252| Command | Capabilities |253|---------|-------------|254| jq | JSON parsing, filtering, transformation |255256## Verify-Only Mode257258When `--verify-only` is specified:2592601. Read existing `.aiwg/smiths/system-definition.yaml`2612. Re-test all listed commands2623. Report any commands that no longer work2634. Do NOT modify the file264265```266Verifying system definition...267268 file-ops: 15/15 commands OK269 text-processing: 15/15 commands OK270 hashing: 4/4 commands OK271 compression: 5/5 commands OK272 network: 6/7 commands CHANGED273 - nc: was available, now missing274 process: 8/8 commands OK275 json: 1/1 commands OK276277Verification complete. 1 command changed.278Run with --update to fix system definition.279```280281## Update Mode282283When `--update` is specified:2842851. Read existing system definition2862. Re-test all commands2873. Add any new commands found2884. Remove commands no longer available2895. Update timestamps2906. Preserve user customizations (if any)291292## Usage Examples293294```bash295# Generate full system definition296/smith-sysdef297298# Test only specific categories299/smith-sysdef --categories file-ops,text-processing300301# Custom output location302/smith-sysdef --output ./custom-sysdef.yaml303304# Verify existing definition305/smith-sysdef --verify-only306307# Update definition with changes308/smith-sysdef --update309```310311## Error Handling312313**No commands available in category**:314```315Warning: Category 'json' has no available commands.316 - jq: not found317318Consider installing: apt install jq (Debian/Ubuntu) or brew install jq (macOS)319```320321**Permission issues**:322```323Warning: Some commands may require elevated permissions:324 - chown: requires root for ownership changes325 - kill: may require root for other users' processes326```327328## Success Criteria329330- [ ] Directory structure created (`.aiwg/smiths/toolsmith/`)331- [ ] System definition file generated with correct YAML format332- [ ] All commands in selected categories tested333- [ ] Capabilities documented for each command334- [ ] Summary report shows available vs missing commands335336## References337338- ToolSmith agent: `@$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/agents/toolsmith-dynamic.md`339- Tool catalog: `.aiwg/smiths/toolsmith/catalog.yaml`