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---2name: smith-sysdef3description: Generate system definition file for ToolSmith with tested OS commands4---56# System Definition Generator78Generate 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.910## Arguments1112- `--categories <list>` - Comma-separated categories to test: file-ops, text-processing, hashing, compression, network, process, json (default: all)13- `--output <path>` - Output file path (default: `.aiwg/smiths/system-definition.yaml`)14- `--verify-only` - Verify existing definition without regenerating15- `--update` - Update existing definition with any new commands1617## Workflow1819### Step 1: Ensure Directory Structure2021Create the smiths directory if it doesn't exist:2223```bash24mkdir -p .aiwg/smiths/toolsmith/tools25mkdir -p .aiwg/smiths/toolsmith/scripts26```2728### Step 2: Probe System Information2930Gather platform details:3132```bash33# OS and kernel34uname -s # OS name (Linux, Darwin)35uname -r # Kernel version36uname -m # Architecture (x86_64, arm64)3738# Distribution (Linux)39cat /etc/os-release 2>/dev/null | grep -E "^(NAME|VERSION)="4041# macOS version42sw_vers 2>/dev/null4344# Shell45echo $SHELL46$SHELL --version 2>/dev/null | head -14748# User environment49echo $HOME50echo $PATH | tr ':' '\n' | head -551```5253### Step 3: Define Command Categories5455Test commands in each category. For each command:561. Check if it exists: `command -v <cmd>` or `which <cmd>`572. Get version if available: `<cmd> --version 2>/dev/null | head -1`583. Note capabilities based on common usage patterns5960**file-ops** - File system operations:61- find, ls, cp, mv, rm, mkdir, rmdir, chmod, chown, stat, file, ln, touch, du, df6263**text-processing** - Text manipulation:64- grep, sed, awk, sort, uniq, cut, tr, head, tail, wc, diff, comm, join, paste, column6566**hashing** - Checksums and hashing:67- md5sum (or md5 on macOS), sha256sum (or shasum -a 256), sha1sum, cksum6869**compression** - Archive and compression:70- gzip, gunzip, tar, zip, unzip, bzip2, xz7172**network** - Network utilities:73- curl, wget, nc (netcat), ping, dig, host, ssh, scp, rsync7475**process** - Process management:76- ps, kill, pkill, pgrep, top, nice, nohup, xargs7778**json** - JSON processing:79- jq8081### Step 4: Test Each Command8283For each command in the selected categories:8485```bash86# Check existence87if command -v <cmd> >/dev/null 2>&1; then88 # Get path89 CMD_PATH=$(command -v <cmd>)9091 # Get version (various methods)92 VERSION=$(<cmd> --version 2>/dev/null | head -1 || <cmd> -V 2>/dev/null | head -1 || echo "unknown")9394 # Mark as tested=true95fi96```9798### Step 5: Generate YAML Output99100Create `.aiwg/smiths/system-definition.yaml`:101102```yaml103# System Definition for ToolSmith104# Generated: <timestamp>105# Platform: <os> <version>106107platform:108 os: "<linux|darwin|windows>"109 distribution: "<Ubuntu 22.04|macOS 14.0|etc>"110 kernel: "<kernel version>"111 shell: "<shell path>"112 shell_version: "<shell version>"113 architecture: "<x86_64|arm64|etc>"114115environment:116 home: "<home directory>"117 path_dirs:118 - /usr/local/bin119 - /usr/bin120 - /bin121 temp_dir: "/tmp"122123categories:124 file-ops:125 description: "File system operations"126 commands:127 - name: find128 path: /usr/bin/find129 version: "4.8.0"130 tested: true131 capabilities:132 - recursive search133 - pattern matching134 - exec actions135 - time filters136 # ... more commands137138 text-processing:139 description: "Text manipulation tools"140 commands:141 # ... commands142143 # ... more categories144```145146### Step 6: Report Summary147148Output a summary of tested commands:149150```151System Definition Generated152============================153Platform: Ubuntu 22.04 (Linux 5.15)154Shell: /bin/bash 5.1.16155Architecture: x86_64156157Categories tested:158 file-ops: 15/15 commands available159 text-processing: 15/15 commands available160 hashing: 4/4 commands available161 compression: 5/7 commands available (missing: xz, bzip2)162 network: 7/9 commands available (missing: nc, dig)163 process: 8/8 commands available164 json: 1/1 commands available165166Total: 55/59 commands verified167168Output: .aiwg/smiths/system-definition.yaml169```170171## Command Capability Mappings172173Map each command to its key capabilities for catalog matching:174175### file-ops176| Command | Capabilities |177|---------|-------------|178| find | recursive search, pattern matching, exec actions, time/size filters |179| ls | directory listing, detailed output, sorting, hidden files |180| cp | copy files, recursive copy, preserve attributes |181| mv | move/rename files, force overwrite |182| rm | remove files, recursive delete, force delete |183| mkdir | create directories, create parents |184| chmod | change permissions, recursive |185| chown | change ownership |186| stat | file metadata, timestamps |187| file | file type detection |188| ln | symbolic links, hard links |189| touch | create files, update timestamps |190| du | disk usage, summarize |191| df | filesystem space |192193### text-processing194| Command | Capabilities |195|---------|-------------|196| grep | pattern matching, regex, recursive, context lines |197| sed | stream editing, substitution, in-place edit |198| awk | field processing, calculations, pattern-action |199| sort | sorting, numeric sort, reverse, unique |200| uniq | deduplicate, count occurrences |201| cut | extract columns, delimiter-based |202| tr | character translation, delete |203| head | first N lines |204| tail | last N lines, follow |205| wc | line/word/char count |206| diff | compare files, unified diff |207| comm | compare sorted files |208209### hashing210| Command | Capabilities |211|---------|-------------|212| md5sum | MD5 checksums |213| sha256sum | SHA-256 checksums |214| sha1sum | SHA-1 checksums |215216### compression217| Command | Capabilities |218|---------|-------------|219| gzip | gzip compression/decompression |220| tar | archive creation/extraction, compression integration |221| zip | zip archive creation |222| unzip | zip extraction |223224### network225| Command | Capabilities |226|---------|-------------|227| curl | HTTP requests, downloads, headers, POST data |228| wget | file downloads, recursive, resume |229| ping | connectivity testing |230| ssh | remote execution |231| rsync | efficient file sync, incremental |232233### process234| Command | Capabilities |235|---------|-------------|236| ps | process listing, detailed info |237| kill | send signals |238| pkill | kill by name |239| pgrep | find processes by name |240| xargs | build commands from input |241242### json243| Command | Capabilities |244|---------|-------------|245| jq | JSON parsing, filtering, transformation |246247## Verify-Only Mode248249When `--verify-only` is specified:2502511. Read existing `.aiwg/smiths/system-definition.yaml`2522. Re-test all listed commands2533. Report any commands that no longer work2544. Do NOT modify the file255256```257Verifying system definition...258259 file-ops: 15/15 commands OK260 text-processing: 15/15 commands OK261 hashing: 4/4 commands OK262 compression: 5/5 commands OK263 network: 6/7 commands CHANGED264 - nc: was available, now missing265 process: 8/8 commands OK266 json: 1/1 commands OK267268Verification complete. 1 command changed.269Run with --update to fix system definition.270```271272## Update Mode273274When `--update` is specified:2752761. Read existing system definition2772. Re-test all commands2783. Add any new commands found2794. Remove commands no longer available2805. Update timestamps2816. Preserve user customizations (if any)282283## Usage Examples284285```bash286# Generate full system definition287/smith-sysdef288289# Test only specific categories290/smith-sysdef --categories file-ops,text-processing291292# Custom output location293/smith-sysdef --output ./custom-sysdef.yaml294295# Verify existing definition296/smith-sysdef --verify-only297298# Update definition with changes299/smith-sysdef --update300```301302## Error Handling303304**No commands available in category**:305```306Warning: Category 'json' has no available commands.307 - jq: not found308309Consider installing: apt install jq (Debian/Ubuntu) or brew install jq (macOS)310```311312**Permission issues**:313```314Warning: Some commands may require elevated permissions:315 - chown: requires root for ownership changes316 - kill: may require root for other users' processes317```318319## Success Criteria320321- [ ] Directory structure created (`.aiwg/smiths/toolsmith/`)322- [ ] System definition file generated with correct YAML format323- [ ] All commands in selected categories tested324- [ ] Capabilities documented for each command325- [ ] Summary report shows available vs missing commands326327## References328329- ToolSmith agent: `@$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/agents/toolsmith-dynamic.md`330- Tool catalog: `.aiwg/smiths/toolsmith/catalog.yaml`