fix: merge upstream save fix (background Bash instead of Write tool)
Resolves merge conflict, keeping upstream's approach: - Background heredoc save instead of Write tool - Adds 📎 footer line - No more "Wrote N lines..." cluttering output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -500,25 +500,23 @@ For `/last30days war in Iran` (NEWS):
|
|||||||
|
|
||||||
## Save Research to Documents
|
## Save Research to Documents
|
||||||
|
|
||||||
After displaying the invitation, save the complete research briefing to the user's Documents folder. This happens automatically on every run.
|
After displaying the invitation, save the complete research briefing to `~/Documents/Last30Days/`. This happens automatically on every run.
|
||||||
|
|
||||||
1. **Create the directory** (if it doesn't exist):
|
**Generate the filename** from TOPIC:
|
||||||
```bash
|
- Lowercase, replace spaces/special chars with hyphens, remove consecutive hyphens, trim to 60 chars
|
||||||
mkdir -p ~/Documents/Last30Days
|
- Example: "Claude Code Best Practices" → `claude-code-best-practices.md`
|
||||||
```
|
- If file already exists, append today's date: `{slug}-YYYY-MM-DD.md`
|
||||||
|
|
||||||
2. **Generate the filename** from TOPIC:
|
**End your invitation with a single `📎` footer line:**
|
||||||
- Lowercase the topic
|
|
||||||
- Replace spaces and special characters with hyphens
|
|
||||||
- Remove consecutive hyphens
|
|
||||||
- Trim to 60 characters max
|
|
||||||
- Example: "Claude Code Best Practices" -> `claude-code-best-practices`
|
|
||||||
|
|
||||||
3. **Check for duplicates**: If `~/Documents/Last30Days/{slug}.md` already exists, append today's date: `{slug}-YYYY-MM-DD.md`
|
```
|
||||||
|
📎 ~/Documents/Last30Days/{slug}.md
|
||||||
|
```
|
||||||
|
|
||||||
4. **Use the Write tool** to save to `~/Documents/Last30Days/{slug}.md` with this exact structure:
|
**Then immediately save using a background Bash command** (`run_in_background: true`):
|
||||||
|
|
||||||
```markdown
|
```bash
|
||||||
|
mkdir -p ~/Documents/Last30Days && cat > ~/Documents/Last30Days/{slug}.md << 'RESEARCH_EOF'
|
||||||
# {TOPIC}
|
# {TOPIC}
|
||||||
|
|
||||||
> Researched {date} | Query type: {QUERY_TYPE} | Target tool: {TARGET_TOOL or "general"}
|
> Researched {date} | Query type: {QUERY_TYPE} | Target tool: {TARGET_TOOL or "general"}
|
||||||
@@ -537,15 +535,20 @@ After displaying the invitation, save the complete research briefing to the user
|
|||||||
|
|
||||||
---
|
---
|
||||||
*Generated by [last30days](https://github.com/mvanhorn/last30days-skill) v2.9.1*
|
*Generated by [last30days](https://github.com/mvanhorn/last30days-skill) v2.9.1*
|
||||||
|
RESEARCH_EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
5. **Confirm briefly** after saving: `Saved to ~/Documents/Last30Days/{slug}.md`
|
**CRITICAL RULES:**
|
||||||
|
1. NEVER use the `Write` tool — it displays "Wrote N lines..." which ruins the experience
|
||||||
|
2. ALWAYS use `run_in_background: true` so the Bash call is nearly invisible
|
||||||
|
3. The `📎` line is part of your text message, not a separate tool call
|
||||||
|
4. The invitation + `📎` line must be the LAST visible thing on screen
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## WAIT FOR USER'S RESPONSE
|
## WAIT FOR USER'S RESPONSE
|
||||||
|
|
||||||
After showing the stats summary with your invitation, **STOP and wait** for the user to respond.
|
**STOP and wait** for the user to respond.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user