How to Configure the Auto-Save Location for last30days-skill
Configure the auto-save location for last30days-skill by passing the --save-dir flag to scripts/last30days.py, which automatically creates the directory, generates URL-safe filenames, and handles naming collisions with date suffixes.
The last30days-skill repository provides a command-line research tool that can persist raw markdown output to disk. When you need to archive research results or integrate the output into documentation workflows, controlling where these files land is essential.
Command-Line Configuration with --save-dir
The auto-save location is set at runtime using the --save-dir argument. This flag is defined in the argument parser at lines 1504–1508 of scripts/last30days.py, where it accepts either absolute paths or paths using the ~ home directory shorthand.
python3 scripts/last30days.py "Your research topic" --save-dir ~/research-output
The script processes this parameter during execution to determine the destination for the raw markdown file.
How the Auto-Save Process Works
Understanding the internal mechanics helps you predict file locations and naming conventions when you configure the auto-save location for last30days-skill.
Directory Preparation
Before writing any content, the script expands ~ to the full home directory path and creates the target directory if it does not exist. This logic resides at lines 1922–1924 in scripts/last30days.py, ensuring the path is valid before file operations begin.
File Naming Convention
The script transforms your research topic into a URL-safe slug using the pattern:
re.sub(r'[^a-z0-9]+', '-', args.topic.lower()).strip('-')[:60]
By default, the output filename follows the format <slug>-raw.md. For example, researching "AI Ethics in 2024" produces ai-ethics-in-2024-raw.md.
Collision Handling
If a file with the target name already exists in the specified directory, the script appends the current date (YYYY-MM-DD) to avoid overwriting existing research. This safeguard is implemented at lines 1925–1928, producing filenames like <slug>-raw-2026-03-25.md.
Content Writing
The actual write operation (lines 1929–1930) combines the compact research output from render.render_compact with a source-status summary, saving the result with UTF-8 encoding.
Confirmation Output
After successfully writing the file, the script prints the absolute path to stderr prefixed with a paperclip emoji (📎) at line 1931, allowing you to quickly locate the saved output.
Practical Examples
Basic Usage with Home Directory
Save research to a directory called ~/research:
python3 scripts/last30days.py "Climate policy developments" --save-dir ~/research
The script creates ~/research automatically if missing, then writes climate-policy-developments-raw.md.
Using Absolute Paths
Specify an exact system path for centralized storage:
python3 scripts/last30days.py "Quantum computing" --save-dir /var/research/last30days
You will see confirmation output similar to:
📎 /var/research/last30days/quantum-computing-raw.md
Handling File Collisions
Running identical topics on the same day creates dated variants automatically:
# First execution
python3 scripts/last30days.py "Open source LLMs" --save-dir ./backups
# Second execution (same topic)
python3 scripts/last30days.py "Open source LLMs" --save-dir ./backups
# Creates: ./backups/open-source-llms-raw-2026-03-25.md
Combining with Other Flags
The --save-dir flag works alongside all other command-line options:
python3 scripts/last30days.py "Neural networks" \
--quick \
--emit=compact \
--save-dir ./outputs
Summary
- Use
--save-dir <PATH>to configure the auto-save location when invokingscripts/last30days.py - The script automatically creates missing directories and expands
~to full paths (lines 1922–1924) - Files are named using URL-safe slugs derived from the research topic, truncated to 60 characters
- Existing files trigger automatic date suffixing to prevent overwrites (lines 1925–1928)
- Confirmation appears in stderr with a 📎 emoji showing the absolute file path (line 1931)
Frequently Asked Questions
What is the default file naming convention for saved research?
The script converts your topic to a lowercase slug by replacing non-alphanumeric characters with hyphens, then appends -raw.md. A topic like "Machine Learning Trends" becomes machine-learning-trends-raw.md. If the topic exceeds 60 characters after slugification, it is truncated to maintain filesystem compatibility.
Does the script create missing directories automatically?
Yes. According to the implementation at lines 1922–1924 in scripts/last30days.py, the script ensures the target directory exists before attempting to write files. It creates parent directories as needed using standard Python directory creation methods, so you do not need to manually prepare the folder structure.
How do I prevent overwriting existing research files?
Collision handling is automatic. If you run the same topic twice without changing the directory contents, the script detects the existing file and appends the current date in YYYY-MM-DD format to the filename (lines 1925–1928). This creates distinct files like topic-raw-2026-03-25.md while preserving your original research output.
Can I use --save-dir with other command-line options?
Yes. The --save-dir flag functions independently of other arguments such as --quick, --emit, or --model. You can combine it with any valid option supported by scripts/last30days.py without conflicts, as demonstrated in the argument parser definition at lines 1504–1508.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →