Workflow
When this skill triggers, follow these steps in order.
Step 1 — Locate the rules file
Check whether the user has specified a rules JSON path.
- If a path is provided, confirm the file exists and is readable.
- If no path is provided, ask: "Please provide the path to your rules JSON file. Each rule must have a
matchobject (with optionalfrom,subjectContains,bodyContains,hasUnsubscribefields), anaction(reply|archive|unsubscribe|calendar|review), and areasonstring. Seeexamples/rules.jsonfor a working example." - If the user has no rules, offer to generate starter rules based on their described inbox patterns before proceeding.
Step 2 — Locate the inbox file
Check whether the user has specified an inbox JSON path.
- If a path is provided, confirm the file exists and contains at least one email object with
id,from,subject, andbodyfields. - If no path is provided, ask: "Please provide the path to your inbox JSON file. Each email must have
id,from,subject, andbodyfields, plus an optionalhasUnsubscribeboolean. Seeresources/inbox.jsonfor a working example."
Step 3 — Run the triage engine
Execute the triage engine from the skill root:
node scripts/triage.mjs <rulesFile> <inboxFile>
The engine outputs a Markdown report to stdout with:
- A per-email table:
id | from | subject | action | reason - A summary count per action
Capture stdout. If the process exits non-zero, surface the stderr message to the user and stop.
Step 4 — Report the triage results
Present the output table and summary to the user. For each action bucket, comment on what it means:
- reply — these emails need a response; act on them today.
- archive — low-value mail filed away; no action needed.
- unsubscribe — subscriptions to remove to reduce future noise.
- calendar — meeting invites or events that need to be scheduled or confirmed.
- review — nothing matched; these need human judgment before acting.
Highlight any review emails first — they are the highest-priority items because no rule has claimed them.
Output format
## Triage Results
| ID | From | Subject | Action | Reason |
|----|------|---------|--------|--------|
...
## Summary
| Action | Count |
|--------|-------|
...
Example
See examples/input.md for a worked inbox scenario and examples/output.md for the full triage report produced by the engine.
Run the example yourself from the skill root:
cd skills/supafax-inbox-triage
bash examples/run.sh