Skip to main content

Syntax

Description

The export command writes the current state of the SQLite database to JSONL (JSON Lines) files. This creates machine-readable, line-delimited JSON files that serve as the source of truth for sudocode projects. Exported files:
  • specs.jsonl - All specifications
  • issues.jsonl - All issues
  • relationships.jsonl - All relationships (optional)
Use export to:
  • Create backups
  • Prepare for migration
  • Generate data for external tools
  • Manually inspect database state
  • Share project state
Most commands automatically export after making changes. Manual export is useful for backups or when working with the database directly.

Arguments

string
required
Output directory for JSONL filesExample: --output /backup/sudocode-exportDirectory will be created if it doesn’t exist. Existing files will be overwritten.

Examples

Basic Export

Export to default location (.sudocode/):
This creates:
  • .sudocode/specs.jsonl
  • .sudocode/issues.jsonl

Export to Backup Directory

Create a dated backup:
Creates timestamped backup directory with all JSONL files.

Export for External Processing

Export to temporary directory for analysis:

JSON Output

Get machine-readable output:

JSONL Format

JSONL (JSON Lines) format stores one JSON object per line:

specs.jsonl

Each line is a complete spec object.

issues.jsonl

Each line is a complete issue object.

Common Workflows

Daily Backup

Create automated backups:

Pre-Migration Export

Before major changes:
1

Export current state

2

Verify export

Check that files exist and have reasonable sizes
3

Perform migration

Make your changes
4

Keep backup

Don’t delete until migration is verified

Share Project State

Export for team member or external tool:
1

Export to clean directory

2

Package

3

Share

Send sudocode-export.tar.gz to collaborator
4

Recipient imports

Data Analysis

Export for external analysis:

Scripting Examples

Incremental Backup

Keep incremental backups:

Export Statistics

Generate report from export:

Export to CSV

Convert JSONL to CSV for spreadsheet:

Understanding Export

What Gets Exported

Specs:
  • All spec fields (id, uuid, title, content, priority, etc.)
  • Archived specs included
  • Parent relationships included
Issues:
  • All issue fields (id, uuid, title, content, status, priority, etc.)
  • Archived issues included
  • Parent relationships included
Not Exported:
  • Relationships (separate file if needed)
  • Tags (embedded in entity data)
  • Feedback (embedded in entity data)
  • Database-only computed views

Export is Source of Truth

JSONL files are the canonical representation:
  • Git-friendly (line-by-line diffs)
  • Human-readable (one object per line)
  • Easy to process (standard JSON)
  • Complete (all entity data)
The database is derived from JSONL via import.

Comparison with Sync

export

Database → JSONL only
  • One direction
  • Overwrites JSONL files
  • No markdown involved
  • Raw data export

sync

Bidirectional full sync
  • Auto-detects direction
  • Handles markdown too
  • Complete workflow
  • Normal operations
Use export when:
  • Creating backups
  • Manual data extraction
  • Preparing for import elsewhere
Use sync when:
  • Normal development workflow
  • After git pull
  • After manual edits

Common Questions

Usually no. Most commands automatically export after making changes. Manual export is useful for:
  • Creating backups
  • Snapshots before major changes
  • Exporting to external tools
  • export: Database → JSONL only, one direction
  • sync: Bidirectional, handles markdown too, auto-detects direction
Use sync for normal operations, export for manual data extraction.
No, export always exports everything. For selective extraction, query JSONL directly:
Relationships are embedded in spec/issue data under the relationships field. A separate relationships.jsonl is not currently created by default.
Yes, export overwrites existing JSONL files in the output directory. Always backup before overwriting important data.
ISO 8601 format: 2025-10-29T10:00:00Z

Troubleshooting

Cause: Cannot write to output directorySolution:
  1. Check directory permissions
  2. Create directory manually:
Cause: No data in databaseSolution: Verify database has data:
If empty, import or create entities first.
Cause: Disk space or write issuesSolution:
  1. Check disk space: df -h
  2. Verify file integrity:
  3. Re-export if needed
Cause: Changes not yet in databaseSolution: Sync first:

import

Import from JSONL

sync

Full bidirectional sync

status

Check project status

Next Steps

1

Export current state

2

Verify export

3

Store safely

Commit to git or copy to backup location
4

Automate

Set up daily backup script

Storage Model

Learn more about sudocode’s storage architecture and JSONL format