# How to Use last30days-skill in Agent Mode: Complete Automation Guide

> Automate your research with last30days-skill in agent mode. Append the flag to skip prompts and run the full pipeline instantly. Get complete research results automatically.

- Repository: [Matt Van Horn/last30days-skill](https://github.com/mvanhorn/last30days-skill)
- Tags: how-to-guide
- Published: 2026-03-25

---

**To use last30days-skill in agent mode, append the `--agent` flag to your query.** This disables interactive prompts, removes the introductory message, and immediately executes the full research pipeline across Reddit, X, Bluesky, Truth Social, YouTube, TikTok, Hacker News, Polymarket, and the web, saving results to `~/Documents/Last30Days/`.

The **last30days-skill** is a Claude Code skill that aggregates discussions from multiple social platforms and synthesizes them into research reports. When you need to run this tool without user interaction—such as in scheduled automation or background agents—you can use **agent mode** to execute the complete workflow silently and emit results immediately.

## What Is Agent Mode?

Agent mode is a non-interactive execution path designed for automation. According to the skill definition in [[`SKILL.md`](https://github.com/mvanhorn/last30days-skill/blob/main/SKILL.md)](https://github.com/mvanhorn/last30days-skill/blob/main/SKILL.md) (lines 150–165), this mode bypasses all user interaction requirements and runs the research engine ([`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py)) autonomously.

When enabled, the skill performs its standard research—gathering 30 days of discussions from Reddit, X, Bluesky, Truth Social, YouTube, TikTok, Hacker News, Polymarket, and web sources—then synthesizes findings without waiting for human input.

## How to Activate Agent Mode

### Claude Code Invocation

In Claude Code or any Claude-compatible client, invoke the skill with the `--agent` flag:

```text
/last30days "plaud granola" --agent

```

The skill detects the flag, runs the complete research pipeline, and returns a compact report immediately. The output includes a generated timestamp, source citations, key findings with bullet points, synthesis sections, and emoji-prefixed statistics.

### Command-Line Usage

For scripts or CI pipelines, use the underlying Python engine directly. While the CLI does not implement a dedicated `--agent` flag, you achieve the same non-interactive behavior by using standard arguments:

```bash
python3 scripts/last30days.py "plaud granola" --emit=compact --no-native-web --save-dir=~/Documents/Last30Days

```

This command runs the research engine at [`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py), emits a compact report, and saves raw data to the specified directory without prompting for input.

## What Changes in Agent Mode

The skill wrapper implements six specific behavioral changes when `--agent` is present:

- **Intro block suppression**: The initial "I'll research…" message is omitted
- **Interactive skip**: `AskUserQuestion` calls are bypassed, and `TARGET_TOOL` defaults to `unknown`
- **Full pipeline execution**: The research script runs normally, followed by a WebSearch pass
- **No pause**: The wait state that normally requires user response is removed
- **Closing suppression**: The final invitation ("I'm now an expert on…") is omitted
- **Immediate output**: The complete research report is emitted instantly, with raw data saved under `~/Documents/Last30Days/`

These modifications ensure the skill can operate in headless environments where no user interaction is possible.

## Automation Examples

### Daily Cron Job

Create a bash script for scheduled briefings:

```bash
#!/usr/bin/env bash
TOPIC="latest AI video tools"
LAST30DAYS_ROOT=$(git rev-parse --show-toplevel)
"$LAST30DAYS_ROOT/scripts/last30days.py" "$TOPIC" --emit=compact --no-native-web --save-dir=~/Documents/Last30Days

```

Schedule this via `cron` or a systemd timer to generate fresh briefings automatically. The script references the core engine at [`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py) and stores outputs in the user's Documents folder.

### CI/CD Integration

For automated reporting in build pipelines:

```bash

# Inside your CI configuration

python3 scripts/last30days.py "$RESEARCH_TOPIC" --emit=compact --save-dir=./reports

```

This produces a machine-readable report without interrupting the build process, suitable for artifact collection or downstream notifications.

## Source Code Architecture

The agent mode behavior is documented in [**[`SKILL.md`](https://github.com/mvanhorn/last30days-skill/blob/main/SKILL.md)**](https://github.com/mvanhorn/last30days-skill/blob/main/SKILL.md), specifically lines 150–165, where the wrapper logic handles the `--agent` flag parsing. The underlying research functionality resides in [**[`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py)**](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py), which remains unchanged between normal and agent modes.

Platform-specific search modules live in `scripts/lib/`, handling Reddit, X, YouTube, and other source APIs. For OpenAI Agents compatibility, metadata definitions are available in [`agents/openai.yaml`](https://github.com/mvanhorn/last30days-skill/blob/main/agents/openai.yaml).

## Summary

- **Use `--agent`** in Claude Code to enable silent, non-interactive research execution
- **Agent mode** removes intro/outro messages, skips `AskUserQuestion` prompts, and eliminates wait states
- **File locations**: Configuration logic in [`SKILL.md`](https://github.com/mvanhorn/last30days-skill/blob/main/SKILL.md) (lines 150–165), core engine in [`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py)
- **Output**: Reports emit immediately and raw data saves to `~/Documents/Last30Days/`
- **CLI equivalent**: Run [`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py) with `--emit=compact` and `--no-native-web` flags for automation scripts

## Frequently Asked Questions

### What happens if I forget the `--agent` flag in an automated script?

The skill will attempt to display the introductory message and may wait for user input at the `AskUserQuestion` step, causing your automation to hang indefinitely. Always use `--agent` for headless environments, or use the direct Python CLI invocation with `--emit=compact`.

### Can I customize the output format when using agent mode?

Yes. When invoking via the command line using [`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py), add the `--emit` parameter with values like `compact`, `detailed`, or `json` to control formatting. The Claude Code `--agent` flag uses the skill's default compact formatting.

### Does agent mode search different sources than normal mode?

No. Both modes use the identical research pipeline defined in [`scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/scripts/last30days.py), searching Reddit, X, Bluesky, Truth Social, YouTube, TikTok, Hacker News, Polymarket, and general web sources. The only difference is the suppression of interactive elements in the wrapper layer.

### Where are the research results stored when running in agent mode?

By default, raw data and reports are saved to `~/Documents/Last30Days/`. You can override this location by specifying `--save-dir=/path/to/directory` when using the direct Python command-line interface.