Publishing and Versioning Prompts¶
This guide explains how to publish prompt libraries and manage versions on-chain. Sage provides two complementary workflows depending on your needs.
Two Publishing Workflows¶
Prompts Workflow (Workspace-Based)¶
Use when: You have a local workspace and want the CLI to handle manifest creation automatically.
# Initialize workspace
sage prompts init
# Create and edit prompts
sage prompts new --name my-prompt --content "You are a helpful assistant..."
sage prompts list
# Publish (builds manifest automatically)
sage prompts publish --dest personal --dao 0xYourDAO
Project Workflow (Manifest-Based)¶
Use when: You want fine-grained control over manifest structure or are composing prompts programmatically.
# Generate manifest template
sage project template basic --out ./manifest.json
# Add prompts to manifest
sage project add-prompt \
--manifest ./manifest.json \
--file ./prompts/hello.md \
--key examples/hello \
--name "Hello World" \
--upload
# Preview before publishing
sage project preview ./manifest.json
# Push to IPFS and create proposal
sage project push ./manifest.json --dao 0xYourDAO --pin
Both workflows result in a versioned library update registered on-chain.
Prompts Workflow Details¶
1. Initialize Workspace¶
Create a Sage workspace in your project:
This creates:
- .sage/workspace.json - Workspace configuration
- prompts/ - Directory for your prompt files
Optionally bind to a DAO:
2. Create and Edit Prompts¶
Create a new prompt:
Or create files directly in prompts/:
cat > prompts/code-review.md << 'EOF'
---
title: Code Review
description: Review code for bugs and improvements
tags: [code, review, quality]
---
You are an expert code reviewer. Analyze the provided code for:
- Bugs and potential issues
- Performance improvements
- Code style and readability
EOF
3. Check Status¶
See what's changed:
View differences from last sync:
4. Test Locally¶
Preview a prompt before publishing:
5. Publish¶
One command builds manifest, uploads to IPFS, and creates a proposal:
Destination options:
- personal - Your personal/vault library (direct update)
- team - Team DAO (Safe multisig approval)
- community - Community DAO (token voting)
6. Follow Governance¶
After publishing to a team or community DAO:
sage proposals inbox --dao 0xYourDAO
sage proposals vote <id> for --dao 0xYourDAO
sage proposals execute <id> --dao 0xYourDAO
Project Workflow Details¶
1. Generate Template¶
# Basic template
sage project template basic --out ./manifest.json
# Advanced template with more fields
sage project template advanced --out ./manifest.json
2. Add Prompts¶
Add prompts to your manifest one at a time:
sage project add-prompt \
--manifest ./manifest.json \
--file ./prompts/sql-helper.md \
--key tools/sql-helper \
--name "SQL Helper" \
--description "Generate and explain SQL queries" \
--upload
The --upload flag automatically uploads the file to IPFS and sets the CID.
3. Generate From Directory¶
Auto-generate a manifest from a directory of prompts:
4. Preview¶
Before publishing, preview your manifest:
5. Validate¶
Check for issues:
6. Push¶
Upload to IPFS and create a proposal:
# Team mode (Safe multisig)
sage project push ./manifest.json --dao 0xTeamDAO --pin --exec
# Community mode (token voting)
sage project push ./manifest.json --dao 0xCommunityDAO --pin
Options:
- --pin - Pin manifest to IPFS providers
- --wait - Wait for pin confirmation
- --warm - Warm public gateways
- --exec - Auto-execute if delay permits (team mode)
How Versioning Works¶
Sage uses IPFS for content-addressed versioning:
- Each publish creates a new CID - A unique identifier for that exact content
- Registry stores the pointer - On-chain registry points to the current approved CID
- All versions persist - Previous versions remain on IPFS forever
- Governance controls updates - Only approved proposals update the pointer
Version 1: QmABC... (approved)
Version 2: QmDEF... (proposed) → Vote → (approved) → QmDEF... is now current
Version 3: QmGHI... (proposed)
View Version History¶
Rollback to Previous Version¶
Manifest Structure¶
A library manifest looks like:
{
"name": "My Prompt Library",
"description": "Collection of useful prompts",
"version": "1.0.0",
"previous": "QmPreviousManifestCID",
"prompts": [
{
"key": "tools/sql-helper",
"name": "SQL Helper",
"description": "Generate and explain SQL queries",
"cid": "QmPromptContentCID",
"tags": ["sql", "database", "query"]
}
]
}
Working with Skills¶
Skills are Claude Code compatible prompt packages. Publish them with:
Create a variant of an existing skill:
Pinning and IPFS¶
Manual Pinning¶
Check Pin Status¶
Provider Options¶
Providers: auto, worker, pinata, w3s
Quick Reference¶
# Prompts workflow
sage prompts init
sage prompts new --name my-prompt
sage prompts status
sage prompts publish --dest personal --dao 0xDAO --pin
# Project workflow
sage project template basic --out ./manifest.json
sage project add-prompt --manifest ./manifest.json --file ./prompt.md --upload
sage project preview ./manifest.json
sage project push ./manifest.json --dao 0xDAO --pin
# Versioning
sage project log --dao 0xDAO
sage project status --dao 0xDAO
sage project rollback QmOldCID --dao 0xDAO
Related¶
- Creating Your First Prompt Library - Getting started
- Agent Prompt Workflows - Agent integration
- IPFS & Pinning - IPFS details