Agent skill

syncing-knowledge-garden

Syncs the sb-knowledge-base Obsidian vault to the knowledge-garden Quartz site. Use after reorganizing content in Obsidian or when the vault has been updated and the Quartz site needs to match.

Stars 8
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/superbenefit/knowledge-base/tree/main/tools/workflows/syncing-content

SKILL.md

Syncing Knowledge Base to Knowledge Garden

Overview

This skill synchronizes content from sb-knowledge-base (Obsidian vault) to knowledge-garden (Quartz static site). The vault is the source of truth—all content reorganization should happen in Obsidian first, then sync to Quartz.

IMPORTANT: Only files with publish: true in their frontmatter are synced. Files without this field or with publish: false are excluded from the knowledge garden.

Note: The knowledge-garden target structure may need updates to match the new vault organization. Coordinate with the KG repository maintainers before running sync operations.

When to Use

  • After reorganizing content in Obsidian
  • After adding or editing published content in the vault
  • When preparing to test a Quartz build with updated content
  • When type definitions have been updated in tools/types/

Repository Structure

sb-knowledge-base (source):

sb-knowledge-base/
├── docs/                    ← Working documents by group
│   ├── aifs/
│   ├── dao-primitives/
│   ├── rpp/
│   └── ...
├── data/                    ← Structured records by type
│   ├── concepts/            ← Lexicon entries
│   ├── links/               ← External resources
│   ├── resources/
│   │   ├── patterns/
│   │   ├── practices/
│   │   ├── primitives/
│   │   ├── protocols/
│   │   └── playbooks/
│   ├── stories/
│   │   ├── articles/
│   │   └── studies/
│   ├── questions/
│   ├── people/
│   ├── groups/
│   ├── projects/
│   ├── places/
│   └── gatherings/
└── tools/
    └── types/               ← FileClass definitions

knowledge-garden (target):

knowledge-garden/
├── content/
│   ├── docs/                ← Sync from docs/
│   ├── data/                ← Sync from data/
│   │   ├── concepts/
│   │   ├── links/
│   │   ├── resources/
│   │   ├── stories/
│   │   └── ...
│   └── types/               ← Sync from tools/types
├── quartz/
└── quartz.config.ts

Workflow

1. Locate Repositories

Find where both repos are cloned on your machine. Common locations:

bash
# Find sb-knowledge-base
find ~ -type d -name "sb-knowledge-base" 2>/dev/null | head -5

# Find knowledge-garden
find ~ -type d -name "knowledge-garden" 2>/dev/null | head -5

Set variables for your paths:

bash
KB_REPO="/path/to/sb-knowledge-base"
KG_REPO="/path/to/knowledge-garden"

2. Verify Clean State

Both repos should have no uncommitted changes before syncing:

bash
cd "$KB_REPO" && git status
cd "$KG_REPO" && git status

3. Sync Content

Sync all content directories:

bash
# Sync docs (working documents)
rm -rf "$KG_REPO/content/docs"/*
cp -r "$KB_REPO/docs"/* "$KG_REPO/content/docs"/

# Sync data (structured records)
rm -rf "$KG_REPO/content/data"/*
cp -r "$KB_REPO/data"/* "$KG_REPO/content/data"/

# Sync types (from tools/types only)
rm -rf "$KG_REPO/content/types"/*
cp -r "$KB_REPO/tools/types"/* "$KG_REPO/content/types"/

4. Verify Sync

bash
# Compare file counts for each content area
echo "=== Docs ==="
echo "Source:" && find "$KB_REPO/docs" -name "*.md" | wc -l
echo "Target:" && find "$KG_REPO/content/docs" -name "*.md" | wc -l

echo "=== Data ==="
echo "Source:" && find "$KB_REPO/data" -name "*.md" | wc -l
echo "Target:" && find "$KG_REPO/content/data" -name "*.md" | wc -l

echo "=== Types ==="
echo "Source:" && find "$KB_REPO/tools/types" -name "*.md" | wc -l
echo "Target:" && find "$KG_REPO/content/types" -name "*.md" | wc -l

5. Test Build

bash
cd "$KG_REPO"
npx quartz build

Quick Sync Commands

For teammates who have both repos in the same parent directory:

bash
# From parent directory containing both repos
# Sync all content
rm -rf knowledge-garden/content/docs/* && cp -r sb-knowledge-base/docs/* knowledge-garden/content/docs/ && \
rm -rf knowledge-garden/content/data/* && cp -r sb-knowledge-base/data/* knowledge-garden/content/data/ && \
rm -rf knowledge-garden/content/types/* && cp -r sb-knowledge-base/tools/types/* knowledge-garden/content/types/

Or use the provided script:

bash
# From sb-knowledge-base root
./tools/workflows/syncing-content/sync-to-garden.sh

Validation Checklist

  • sb-knowledge-base is on correct branch
  • knowledge-garden is on correct branch
  • Both repos have clean git status
  • File counts match after sync
  • npx quartz build succeeds
  • Spot-check a few pages in dev server

Troubleshooting

Build fails with type errors

The Quartz type definitions may not match the new content structure. Check content/types/ and quartz/types/typeRegistry.ts.

Missing files after sync

Ensure you used cp -r (recursive) and included the trailing /* to copy contents, not the folder itself.

Links broken on site

Content should be reorganized IN Obsidian first (which auto-updates links), then synced. If you moved files outside Obsidian, links won't be updated.

Notes

  • Source of truth: sb-knowledge-base (the Obsidian vault)
  • Never edit content directly in knowledge-garden—it will be overwritten on next sync
  • Always reorganize content in Obsidian to preserve internal links

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results