Syntax
Description
Theimport command reads JSONL (JSON Lines) files and loads them into the SQLite database. This is the inverse operation of export.
Imported files:
specs.jsonl- Specificationsissues.jsonl- Issuesrelationships.jsonl- Relationships (if present)
import to:
- Restore from backups
- Initialize new database from JSONL
- Migrate data between systems
- Recover from database corruption
- Load shared project data
sync works internally.Arguments
--input backups/2025-10-29Directory must contain specs.jsonl and/or issues.jsonl files.Examples
Basic Import
Import from a directory:Expected output
Expected output
.sudocode/specs.jsonl and .sudocode/issues.jsonl and loads them into the database.
Restore from Backup
Restore database from backup:Expected output
Expected output
Initialize New Database
Set up fresh database from JSONL:Ensure clean state
Import from JSONL
Verify
Import Shared Data
Load data shared by team member:Expected output
Expected output
JSON Output
Get machine-readable output:JSON output
JSON output
How Import Works
Import processes JSONL files line by line:Read JSONL files
specs.jsonl and issues.jsonl from input directoryEach line is one JSON object representing an entityValidate data
Insert/update database
- Check if ID exists in database
- Insert if new, update if exists
- Preserve UUIDs and timestamps
Import relationships
relationships.jsonl exists, import relationship dataTags and other metadata embedded in entity recordsCommon Workflows
Disaster Recovery
Recover from database corruption:Backup corrupted database
Import from JSONL (source of truth)
Sync to markdown
Verify
Migration from Old Version
Migrate data from older sudocode version:Export from old version
Copy JSONL files
Import in new version
Verify migration
Team Collaboration
Share and merge project data:Team member A exports
Team member B receives and imports
Handle conflicts
Periodic Restore Test
Verify backups are valid:Import Behavior
Conflict Resolution
When importing data that conflicts with existing database: Default behavior: Upsert (insert or update)- If entity ID exists: Update with imported data
- If entity ID doesn’t exist: Insert new entity
- Timestamps from JSONL are preserved
- No manual conflict resolution
Data Preservation
What’s preserved during import:- Entity IDs (SPEC-001, ISSUE-001, etc.)
- UUIDs
- Timestamps (created_at, updated_at, closed_at)
- All entity fields (title, content, priority, status, etc.)
- Parent relationships
- Tags
- Archived status
Missing Files
If files are missing:- Only
specs.jsonl→ Imports specs only - Only
issues.jsonl→ Imports issues only - Both missing → Error (nothing to import)
- Extra files → Ignored
Scripting Examples
Automated Backup Restore
Test backup integrity automatically:Merge Multiple Exports
Combine data from multiple sources:Selective Import
Import only specific entities:Comparison with Sync and Export
import
- One direction
- Overwrites database
- No markdown involved
- Restoration/migration
export
- One direction
- Overwrites JSONL
- No markdown involved
- Backup/extraction
sync
- Auto-detects direction
- Handles all layers
- Complete workflow
- Normal operations
- Normal operations: Use
sync - Create backup: Use
export - Restore backup: Use
importthensync --to-markdown
Common Questions
Does import delete existing data?
Does import delete existing data?
- Matching IDs: Updated with imported data
- New IDs: Inserted as new entities
- Existing IDs not in import: Remain unchanged
What happens to markdown files after import?
What happens to markdown files after import?
Can I import from multiple sources?
Can I import from multiple sources?
- Merge JSONL files manually using
jq - Import the merged result
Are relationships imported?
Are relationships imported?
relationships.jsonl exists in the input directory.What if JSONL format is invalid?
What if JSONL format is invalid?
Can I import into an existing project?
Can I import into an existing project?
Troubleshooting
Error: Input directory doesn't exist
Error: Input directory doesn't exist
Error: No JSONL files found
Error: No JSONL files found
specs.jsonl or issues.jsonlSolution:
Check contents:Import succeeds but data is missing
Import succeeds but data is missing
- Check database:
- Sync to markdown:
Import fails with parse error
Import fails with parse error
Database locked during import
Database locked during import
- Close other sudocode processes
- Wait and retry
- Check for zombie processes:
Related Commands
Next Steps
Backup current state
Import data
Sync to markdown
Verify import
Commit changes

