task icon Task

Analyze Inbox Ecosystem

Classify emails into biological species, compute ecosystem health, and generate Attenborough narration

Requirements
Gmail must be connected. Optionally specify time range (default: last 30 days) and max emails to analyze (default: 200).
1

Check if Gmail is connected. If not, guide the user through OAuth setup before proceeding.

5

Read stateRaw Inbox Data. Using the taxonomy guide, classify each significant sender into a species type. Count specimens per species and note examples.

6

Compute ecosystem health (0-100): Biodiversity (0-25), Balance (0-25), Sustainability (0-25), Conservation Status (0-25). Determine status: Thriving/Stable/Stressed/Critical.

7

Write the analysis to stateEcosystem Analysis as JSON with species counts, health metrics, dominant species, extinct species, and conservation actions.

9

Generate Attenborough narration using the style guide. Write to stateEcosystem Portrait Draft with the narration, census, and health breakdown.

12

Present the narration dramatically. Ask which biome for their portrait: Savanna (African), Ocean (reef), or Forest (woodland).

                    To run this task you must have the following required information:

> Gmail must be connected. Optionally specify time range (default: last 30 days) and max emails to analyze (default: 200).

If you don't have all of this information, exit here and respond asking for any extra information you require, and instructions to run this task again with ALL required information.

---

You MUST use a todo list to complete these steps in order. Never move on to one step if you haven't completed the previous step. If you have multiple CONSECUTIVE read steps in a row, read them all at once (in parallel). Otherwise, do not read a file until you reach that step.

Add all steps to your todo list now and begin executing.

## Steps

1. Check if Gmail is connected. If not, guide the user through OAuth setup before proceeding.

2. [Gather Arguments: Fetch Gmail Messages] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `query`: is:inbox newer_than:30d
- `maxResults` (default: "50"): 200 or user-specified max

3. [Run Code: Fetch Gmail Messages]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/gmail.inbox.fetch/preview,
    "args": [
      "query",
      "maxResults"
    ]
  },
  "packages": null
}
```

4. [Gather Arguments: Compute Gmail Stats] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `inputPath` (default: "session/emails.json"): the emails file from the previous step
- `metrics` (default: "senders,volume"): senders,volume,domains,hours

5. [Run Code: Compute Gmail Stats]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/gmail.inbox.stats/preview,
    "args": [
      "inputPath",
      "metrics"
    ]
  },
  "packages": null
}
```

6. [Read Inbox Ecosystem Species Taxonomy]: Read the documentation in: `skills/sauna/[skill_id]/references/email.ecosystem.taxonomy.md` (Species classification guide)

7. Read `session/ecosystem-raw.json`. Using the taxonomy guide, classify each significant sender into a species type. Count specimens per species and note examples.

8. Compute ecosystem health (0-100): Biodiversity (0-25), Balance (0-25), Sustainability (0-25), Conservation Status (0-25). Determine status: Thriving/Stable/Stressed/Critical.

9. Write the analysis to `session/ecosystem-analysis.json` as JSON with species counts, health metrics, dominant species, extinct species, and conservation actions.

10. [Read Attenborough Narration Style Guide]: Read the documentation in: `skills/sauna/[skill_id]/references/email.ecosystem.narration.md` (Attenborough voice style guide)

11. Generate Attenborough narration using the style guide. Write to `session/ecosystem-portrait.md` with the narration, census, and health breakdown.

12. [Read Ecosystem Analysis]: Read the file at `session/ecosystem-analysis.json` into context (Reference the analysis just written)

13. [Read Ecosystem Portrait Draft]: Read the file at `session/ecosystem-portrait.md` into context (Reference the portrait narrative just written)

14. Present the narration dramatically. Ask which biome for their portrait: Savanna (African), Ocean (reef), or Forest (woodland).