Skill: chunhualiao/save-to-obsidian (version 1.1.0)

--- name: save-to-obsidian description: Saves markdown content to remote Obsidian vault via SSH version: 1.0.0 --- # Save to Obsidian Saves markdown content to remote Obsidian vault via SSH. ## Prerequisite **This skill is for machines WITHOUT iCloud sync** (e.g., Linux/Ubuntu servers). If your machine already has iCloud Desktop sync enabled and direct access to the Obsidian vault, you don't need this skill — just copy files directly to the vault path. ## When to Use User says: "save to obsidian", "send to obsidian", "copy to obsidian" ## Process 1. Write content to a temp .md file (enforce formatting rules below) 2. Copy to remote vault: `scp <filepath> user@remote-host:/path/to/obsidian/vault/` 3. Confirm success to user **Example:** ```bash # Write content to temp file cat > /tmp/my-note.md << 'EOF' # My Note Content here EOF # Copy to remote Obsidian vault scp /tmp/my-note.md [REDACTED_SECRET]:~/Obsidian/MyVault/ # Clean up rm /tmp/my-note.md ``` **Configuration:** The agent should use the SSH host and vault path configured in workspace TOOLS.md ## Formatting Rules All content saved to Obsidian MUST follow these rules: ### Diagrams: Use Mermaid (mandatory) - **Never** use ASCII box diagrams, ASCII art, or plaintext diagrams - **Always** use Mermaid fenced code blocks (` ```mermaid `) - Obsidian renders Mermaid natively — ASCII diagrams look broken - Supported types: flowchart, sequence, state, class, ER, gantt, pie, mindmap, timeline, quadrant, graph ### Tables: Use Markdown tables - Obsidian renders markdown tables natively - For complex data, prefer tables over bullet lists ### Links: Use wiki-links or relative links - Link between Obsidian notes: `[[note-name]]` - External links: standard markdown `[text](url)` ### General - Use headers (##) for structure — Obsidian outline panel relies on them - Use YAML frontmatter if metadata is needed - Keep filenames kebab-case (no spaces) for cross-platform compatibility ## Agent Owner This skill is executed by the main OpenClaw agent session. The `save-to-obsidian.sh` script runs as a shell command via the exec tool. No sub-agents are spawned. iCloud sync is handled automatically after file transfer — no agent action needed. ## Success Criteria Save succeeds when: 1. scp exits with code 0 2. File appears in vault directory with correct filename 3. iCloud sync propagates the file (typically 1-2 minutes; not verified by skill) Failure conditions: SSH unreachable, vault path does not exist, disk full, filename contains characters invalid for iCloud sync (handled by sanitization in script). ## Edge Cases - **SSH failure**: script exits with error message and non-zero code; agent should report and stop - **Duplicate filename**: overwrites silently — scp does not warn; user must check if overwrite is desired - **Special characters in filename**: sanitized by script (spaces → hyphens, invalid chars stripped) - **Empty content**: scp will transfer a 0-byte file; not an error but should be flagged - **No clear title**: if content has no H1 header, agent should prompt user for filename before saving - **iCloud sync delay**: file appears in vault within 1-2 min; if not visible after 5 min, check iCloud status ## Notes - Uses existing SSH key auth (no password) - Target: remote-host → Obsidian vault location - Files sync via iCloud automatically (if vault is in iCloud folder) ## Configuration This skill reads SSH and vault configuration from your workspace TOOLS.md: | Variable | Description | Where to set | |----------|-------------|--------------| | SSH host | Hostname/IP of the remote machine hosting the Obsidian vault | TOOLS.md (e.g., `myserver.local`) | | SSH user | Username on the remote machine | TOOLS.md (e.g., `your-username`) | | SSH key path | Path to SSH private key (default: `~/.ssh/id_rsa`) | TOOLS.md | | Vault path | Absolute path to Obsidian vault on remote machine | TOOLS.md (e.g., `~/Obsidian/MyVault/`) | **Example TOOLS.md entry:** ``` ## Obsidian Remote Vault - SSH host: myserver.local - SSH user: your-username - Vault path: ~/Obsidian/MyVault/ ``` No API keys or tokens required — uses SSH key authentication only.

path: CHANGELOG.md
content: # Changelog

## [1.1.0] - 2026-02-17
### Added
- scripts/save-to-obsidian.sh with error handling, filename sanitization, iCloud guidance
- Agent owner declaration
- Success criteria section
- Edge cases section (SSH failure, duplicates, special chars, iCloud delay)
- Additional trigger phrases in skill.yml (save this, copy output, add to vault)
- Updated test-triggers.json with 6 positive + 3 negative cases
- display_name in skill.yml

## v1.0.0 — 2026-02-16

Initial release of save-to-obsidian skill.

**Features:**
- Save markdown content to Obsidian vault via SSH
- Automatic formatting enforcement (Mermaid diagrams, markdown tables, kebab-case filenames)
- Support for wiki-links and frontmatter
- Trigger: "save to obsidian", "send to obsidian", "copy to obsidian"


path: README.md
content: # Save to Obsidian

An OpenClaw skill that saves markdown content to an Obsidian vault via SSH, with automatic formatting rules for diagrams, tables, and links.

## Prerequisite

**This skill is for machines WITHOUT iCloud sync** (e.g., Linux/Ubuntu servers, remote machines). If your machine already has iCloud Desktop sync enabled and direct access to the Obsidian vault folder, you don't need this skill — just copy files directly to the vault path.

## What It Does

This skill allows your OpenClaw agent to save any generated markdown content directly to your Obsidian vault on a remote machine. It automatically enforces formatting rules to ensure content renders properly in Obsidian:
- Converts or enforces Mermaid diagrams (no ASCII art)
- Uses markdown tables (Obsidian native rendering)
- Applies kebab-case filenames for cross-platform compatibility

## How to Install

1. Copy this skill to your OpenClaw skills directory
2. Set up SSH access to the remote machine hosting your Obsidian vault
3. Create a script at `~/.openclaw/scripts/save-to-obsidian.sh` that copies files to your vault location
4. Ensure the script is executable and works with your SSH key

Example script:
```bash
#!/bin/bash
scp "$1" user@remote-host:/path/to/obsidian-vault/
```

## Usage

Say to your agent:
- "save to obsidian"
- "send to obsidian"  
- "copy to obsidian"

The agent will format the content appropriately and transfer it to your vault.

## Requirements

- SSH access to the remote machine hosting the Obsidian vault
- Obsidian vault accessible on the remote machine
- A save-to-obsidian.sh script configured for your setup
- **Note:** Not needed if your local machine already has iCloud sync to the vault

## Future Work

- Support for multiple vault destinations
- Direct iCloud sync without SSH intermediary
- Automatic tagging and frontmatter generation
- Batch save operations

## License

MIT


path: references/README.md
content: # References

- [Obsidian Markdown Guide](https://help.obsidian.md/Editing+and+formatting/Basic+formatting+syntax)
- [Mermaid Documentation](https://mermaid.js.org/)
- [Obsidian Mermaid Support](https://help.obsidian.md/Editing+and+formatting/Advanced+formatting+syntax#Diagram)


path: scripts/save-to-obsidian.sh
content: #!/bin/bash
# Save content to Obsidian vault via scp
# Usage: ./save-to-obsidian.sh <source_file> <vault_dir> [ssh_host] [filename_override]
# Set OBSIDIAN_HOST and OBSIDIAN_VAULT_PATH in TOOLS.md

set -euo pipefail

SOURCE="${1:?Usage: $0 <source_file> <vault_dir> [ssh_host] [filename_override]}"
VAULT_DIR="${2:?Usage: $0 <source_file> <vault_dir> [ssh_host] [filename_override]}"
SSH_HOST="${3:-${OBSIDIAN_HOST:-}}"
FILENAME="${4:-$(basename "$SOURCE")}"

if [[ -z "$SSH_HOST" ]]; then
    echo "Error: SSH host required (arg 3 or OBSIDIAN_HOST env var)"
    exit 1
fi

# Sanitize filename (no spaces, safe for iCloud)
SAFE_FILENAME=$(echo "$FILENAME" | tr ' ' '-' | tr -cd '[:alnum:]._-')
if [[ -z "$SAFE_FILENAME" ]]; then
    SAFE_FILENAME="obsidian-note-$(date +%Y%m%d-%H%M%S).md"
fi

DEST_PATH="${VAULT_DIR}/${SAFE_FILENAME}"

echo "Saving to Obsidian..."
echo "  Source: $SOURCE"
echo "  Dest:   ${SSH_HOST}:${DEST_PATH}"

if scp "$SOURCE" "${SSH_HOST}:${DEST_PATH}"; then
    echo "✅ Saved: $SAFE_FILENAME"
    echo "   iCloud sync will propagate within 1-2 minutes"
else
    echo "❌ scp failed. Check: SSH access to $SSH_HOST, vault path exists, disk space"
    exit 1
fi


path: skill.yml
content: name: save-to-obsidian
display_name: "Save to Obsidian"
description: Saves markdown content to remote Obsidian vault via SSH
version: 1.1.0
triggers:
  - save to obsidian
  - send to obsidian
  - copy to obsidian
  - save this to obsidian
  - copy the output to obsidian
  - add this to my vault
  - put this in obsidian


path: tests/test-triggers.json
content: {
  "shouldTrigger": [
    "save to obsidian",
    "send to obsidian",
    "copy to obsidian",
    "save this to obsidian",
    "can you send this to obsidian?",
    "copy the output to obsidian",
    "add this to my vault",
    "put this in obsidian",
    "please save this to obsidian",
    "put this note in obsidian"
  ],
  "shouldNotTrigger": [
    "save to github",
    "add to notes app",
    "copy to clipboard",
    "open obsidian",
    "read from obsidian",
    "search obsidian"
  ]
}


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)