feat: add visualization tools and fix environment variables #5

Merged
brad merged 2 commits from fix/env-vars-and-tools into main 2026-02-13 10:57:13 -08:00
Owner

Problem

WORKSPACE_PATH environment variable was not available in interactive shells because:

  1. It relied solely on load-agent-config.py parsing AGENTS.md
  2. If AGENTS.md was missing or in an unexpected location, the variable was never set
  3. Silent failures meant debugging was difficult

Solution

1. Set WORKSPACE_PATH in Dockerfile

ENV WORKSPACE_PATH=/workspace

2. Add fallback in agent-config.sh

export WORKSPACE_PATH="${WORKSPACE_PATH:-/workspace}"

This ensures the variable is always available, even if AGENTS.md parsing fails.

3. Add visualization tools

Installed via npm:

  • vl-convert-cli — Vega-Lite to PNG/SVG rendering (used by dataviz skill)
  • @mermaid-js/mermaid-cli — Mermaid diagram rendering (used by mermaid skill)

4. Updated documentation

  • Documented environment variables in README
  • Listed all installed features and tools
  • Added example docker-compose volume mount

Testing

After rebuild:

docker exec -it openclaw-sbx-<container> bash -l
echo $WORKSPACE_PATH  # Should output: /workspace

Impact

  • Subagents can now use dataviz and mermaid skills without "command not found" errors
  • WORKSPACE_PATH is reliably available in all shell contexts
  • Derived paths (BLOG_PATH, WORK_PATH, etc.) will also work correctly
## Problem `WORKSPACE_PATH` environment variable was not available in interactive shells because: 1. It relied solely on `load-agent-config.py` parsing `AGENTS.md` 2. If AGENTS.md was missing or in an unexpected location, the variable was never set 3. Silent failures meant debugging was difficult ## Solution ### 1. Set WORKSPACE_PATH in Dockerfile ```dockerfile ENV WORKSPACE_PATH=/workspace ``` ### 2. Add fallback in agent-config.sh ```bash export WORKSPACE_PATH="${WORKSPACE_PATH:-/workspace}" ``` This ensures the variable is always available, even if AGENTS.md parsing fails. ### 3. Add visualization tools Installed via npm: - **vl-convert-cli** — Vega-Lite to PNG/SVG rendering (used by dataviz skill) - **@mermaid-js/mermaid-cli** — Mermaid diagram rendering (used by mermaid skill) ### 4. Updated documentation - Documented environment variables in README - Listed all installed features and tools - Added example docker-compose volume mount ## Testing After rebuild: ```bash docker exec -it openclaw-sbx-<container> bash -l echo $WORKSPACE_PATH # Should output: /workspace ``` ## Impact - ✅ Subagents can now use dataviz and mermaid skills without "command not found" errors - ✅ WORKSPACE_PATH is reliably available in all shell contexts - ✅ Derived paths (BLOG_PATH, WORK_PATH, etc.) will also work correctly
- Install vl-convert-cli for Vega-Lite rendering (dataviz skill)
- Install mermaid-cli for Mermaid diagram rendering (mermaid skill)
- Set WORKSPACE_PATH as ENV variable in Dockerfile (default: /workspace)
- Add fallback in agent-config.sh to ensure WORKSPACE_PATH is always set
- Document environment variables and features in README

Fixes issue where WORKSPACE_PATH was not available in interactive shells
because it relied solely on AGENTS.md parsing which could fail silently.
- Add DEBUG_AGENT_CONFIG=1 environment variable for verbose logging
- Log to stderr so it doesn't interfere with exports
- Show all search paths checked and where AGENTS.md was found
- Log parsing method used (PyYAML vs fallback)
- Show each derived path and export count
- Reorder search paths: /workspace first (most common)
- Remove 2>/dev/null so errors are visible by default
- Document debug mode in README with example output

Now you can troubleshoot config loading issues:
  export DEBUG_AGENT_CONFIG=1
  bash -l

This shows exactly where it's looking, what it finds, and what it exports.
Author
Owner

Added Debug Mode

The script now has verbose logging to troubleshoot config loading issues.

How to use:

# Inside container
export DEBUG_AGENT_CONFIG=1
bash -l

Example output:

[load-agent-config] Starting agent config loader
[load-agent-config] PyYAML available: True
[load-agent-config] Current working directory: /home/sandbox
[load-agent-config] Home directory: /home/sandbox
[load-agent-config] Searching for AGENTS.md in 4 locations...
[load-agent-config]   Checking: /workspace/AGENTS.md
[load-agent-config]   ✓ Found: /workspace/AGENTS.md
[load-agent-config] Read 523 chars from /workspace/AGENTS.md
[load-agent-config] Found YAML block (145 chars)
[load-agent-config] Parsed 3 config keys with PyYAML
[load-agent-config] Workspace path: /workspace
[load-agent-config] Set WORKSPACE_PATH=/workspace
[load-agent-config] Derived BLOG_PATH=/workspace/diary from BLOG_REPO=agent/diary
[load-agent-config] Derived WORK_PATH=/workspace/artifacts from WORK_REPO=agent/artifacts
[load-agent-config] Exported 7 environment variables

This will show exactly:

  • Where it's searching for AGENTS.md
  • Which path it found (or why it didn't find any)
  • What it parsed from the YAML block
  • What variables it exported

The fallback WORKSPACE_PATH=/workspace ensures variables are always available, but the debug mode lets us see if the script is working correctly.

## Added Debug Mode The script now has verbose logging to troubleshoot config loading issues. ### How to use: ```bash # Inside container export DEBUG_AGENT_CONFIG=1 bash -l ``` ### Example output: ``` [load-agent-config] Starting agent config loader [load-agent-config] PyYAML available: True [load-agent-config] Current working directory: /home/sandbox [load-agent-config] Home directory: /home/sandbox [load-agent-config] Searching for AGENTS.md in 4 locations... [load-agent-config] Checking: /workspace/AGENTS.md [load-agent-config] ✓ Found: /workspace/AGENTS.md [load-agent-config] Read 523 chars from /workspace/AGENTS.md [load-agent-config] Found YAML block (145 chars) [load-agent-config] Parsed 3 config keys with PyYAML [load-agent-config] Workspace path: /workspace [load-agent-config] Set WORKSPACE_PATH=/workspace [load-agent-config] Derived BLOG_PATH=/workspace/diary from BLOG_REPO=agent/diary [load-agent-config] Derived WORK_PATH=/workspace/artifacts from WORK_REPO=agent/artifacts [load-agent-config] Exported 7 environment variables ``` This will show exactly: - Where it's searching for AGENTS.md - Which path it found (or why it didn't find any) - What it parsed from the YAML block - What variables it exported The fallback `WORKSPACE_PATH=/workspace` ensures variables are always available, but the debug mode lets us see if the script is working correctly.
brad merged commit b8021e3b4c into main 2026-02-13 10:57:13 -08:00
brad deleted branch fix/env-vars-and-tools 2026-02-13 10:57:14 -08:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
commune/sandbox!5
No description provided.