# Sync

> >

- **Type:** Skill
- **Install:** `agentstack add skill-eliransu-digital-brain-sync`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [eliransu](https://agentstack.voostack.com/s/eliransu)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [eliransu](https://github.com/eliransu)
- **Source:** https://github.com/eliransu/digital-brain/tree/main/skills/sync
- **Website:** https://github.com/eliransu/digital-brain

## Install

```sh
agentstack add skill-eliransu-digital-brain-sync
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# sync: Daily Mentions + Hot Topics Sync

Pull everything that needs your attention from the last 48h across Gmail, Slack, Linear, Calendar into the wiki daily folder. Surface as bullets in chat at the end.

User identity: `you@example.com` (Slack handle resolved from this).

---

## Scope

| Source   | What to pull                                                          | Window   | Filed under                |
| -------- | --------------------------------------------------------------------- | -------- | -------------------------- |
| Gmail    | Threads where you is in To/Cc OR appears in body as a mention      | 48h      | `daily//mentions.md` |
| Slack    | `@your-handle` mentions in any public/private channel                     | 48h      | `daily//mentions.md` |
| Slack    | `@your-handle` mentions in groups (group DMs / mpdm)                      | 48h      | `daily//mentions.md` |
| Slack    | DMs received from any user                                            | **24h**  | `daily//mentions.md` |
| Slack    | Hot topics from configured channels (high reply or reaction count)    | 48h      | `daily//topics.md`   |
| Linear   | Issues assigned to you (any status except Done/Canceled)           | open     | `daily//linear.md`   |
| Linear   | Comments mentioning you                                            | 48h      | `daily//linear.md`   |
| Calendar | Events you is invited to                                           | next 48h | `daily//calendar.md` |
| Notes    | Active vault notes (`status: open`, not expired) — from `wiki/notes/` | open     | `daily//notes.md`    |

---

## Config

Read `wiki/daily/_config.json`. If missing, create it with:

```json
{
  "user_email": "you@example.com",
  "slack_user_handle": "your-handle",
  "slack_hot_channels": ["CXXXXXXXXXX", "CXXXXXXXXXX"],
  "calendar_id": "primary",
  "linear_user_email": "you@example.com",
  "linear_default_team_key": "TEAM",
  "linear_default_team_id": "",
  "linear_user_id": ""
}
```

`linear_default_team_key` / `linear_default_team_id` / `linear_user_id` are used by `/task` and the notes sweep. The two `_id` fields start empty and get cached after the first MCP lookup.

Config is the source of truth for which channels count as "hot". User edits this file to add/remove channels.

---

## Workflow

1. **Compute time windows.** Use `date` (Bash) or built-in date math.
   - `today` = `YYYY-MM-DD` in local time
   - `since_48h_iso` = now - 48h in RFC3339 UTC
   - `since_24h_iso` = now - 24h in RFC3339 UTC
   - `next_48h_iso` = now + 48h in RFC3339 UTC

2. **Load or scaffold config.** Read `wiki/daily/_config.json`. If missing, write the default above and proceed.

3. **Resolve user IDs once.**
   - Slack: `slack_search_users` with query `your-handle` → cache the user ID
   - Linear: `list_users` filtered by email `you@example.com` → cache the user ID

4. **Sweep expired notes.** Before pulling anything else, scan `wiki/notes/*.md`. For each file where `status: open` and `today > expires` (date compare), flip `status: expired` and bump `updated:` to today. Drop those rows from `wiki/notes/_index.md`. Cheap, idempotent, runs every sync.

5. **Pull from all sources in parallel** (issue tool calls in one assistant turn).

   **Token discipline (mandatory).** Every Slack call MUST pass `response_format: "concise"` and `include_context: false`. Context chains account for >half the token cost of /sync — Slack repeats the same message 18 times across context-before/after blocks of nearby results. Never bulk-read 100 messages out of a channel to find 2-3 hot threads; search for the threads, then read them. Target total /sync turn cost: under 15k tokens of tool output. If you blow past that, you skipped these flags somewhere.
   - **Gmail** — `search_threads` with query `(to:me OR cc:me OR "your-handle") newer_than:2d -category:promotions -category:social` and `pageSize: 50`. Snippet + headers are enough; don't follow up with `get_thread` unless the snippet is unreadable.
   - **Slack channel/group mentions** — `slack_search_public_and_private` with `query: "@ after:"`, `channel_types: "public_channel,private_channel"`, `response_format: "concise"`, `include_context: false`, `limit: 20`. The result already contains the full text of each hit.
   - **Slack DMs (24h)** — `slack_search_public_and_private` with `query: "is:dm after:"`, `channel_types: "im,mpim"`, `response_format: "concise"`, `include_context: false`, `limit: 20`. If DM filtering returns junk, fall back to a second search `to:me after:` with the same options.
   - **Slack hot topics** — DO NOT bulk-read each channel. For each channel ID in `slack_hot_channels`, issue `slack_search_public_and_private` with `query: "in: is:thread after:"`, `response_format: "concise"`, `include_context: false`, `limit: 10`, `sort: "score"`. Take the top 5 per channel. Only call `slack_read_thread` on a specific message if the snippet is too truncated to summarize.
   - **Linear assigned** — `list_issues` with `assignee: "me"`, `updatedAt: "-P14D"`, `limit: 50`. The 14-day window cuts stale backlog that doesn't change daily. If the response still exceeds the tool limit, narrow to `-P7D` and add `state: "started"` (in-progress only). On the first /sync of a day, reuse yesterday's `linear.md` backlog rows verbatim and only overwrite issues that appear in the active set — backlog issues with no `updatedAt` change carry forward.
   - **Linear mentions** — skip the dedicated lookup. Linear's notification emails already surface `@mention` events via Gmail. Only call `list_comments` on a specific issue when the chat surfaces an unresolved question on it.
   - **Calendar** — `list_events` with `calendarId=primary`, `startTime=`, `endTime=`, `orderBy=startTime`, `pageSize: 50`. Don't request full event descriptions; summary + attendees + time are enough.

6. **Flywheel: recognize and file new people BEFORE writing the daily files.**
   Read `wiki/entities/people/_index.md`. For every distinct person name extracted from this batch — Gmail senders/recipients (excluding notification bots), Slack message authors, Slack `@mentions`, Linear comment authors, Calendar attendees — check:
   - Is there a page at `wiki/entities/people/.md` or an alias match in `_index.md`?
   - If **no**, and the name appears either (a) ≥2x in this batch, or (b) once with a clear role signal (email signature, channel pin, "Head of X", `@` ping), then file them now via the `ppl` skill's add flow. Use best-guess role from context; if uncertain, file with `role: "—"` + a `> [!todo] Confirm role` callout. Default `company: Your Organization` unless the source domain says otherwise (e.g. `@external1.com`, `@external2.com`, `@external3.com` → External).
   - Track the list of newly-filed people; surface it in the chat summary so the user can correct roles.

   Why: the wiki's compounding value is the link graph. Each `/sync` should add nodes, not just edges. Never emit a `[[Name]]` wikilink to a non-existent page (phantom link rots the graph), and never silently skip a recognizable person. File or don't link — those are the only two options.

7. **Snapshot active notes.** After the sweep, glob `wiki/notes/*.md` and load every file with `status: open`. Sort by `due` ascending. These rows go into `daily//notes.md` (template below) and feed the Top-10 alongside Gmail / Slack / Linear / Calendar.

8. **Check for existing date folder.** `wiki/daily//`:
   - **If missing**: create folder. Write all five files from scratch using the templates below.
   - **If present**: dedupe each item against the existing file by stable ID (see "Dedup keys" below). Append new items under a heading `## Update HH:MM` at the bottom of each file. `notes.md` is **regenerated whole** each run (not append-dedup) — it's a live snapshot of the working set.

9. **Print chat output.** Show all items collected this run as bullets, grouped by source (notes included). End with the absolute paths written/updated.

---

## Dedup keys

| Source         | Stable key                                 |
| -------------- | ------------------------------------------ |
| Gmail thread   | `gmail:`                         |
| Slack message  | `slack::` or the permalink |
| Linear issue   | `linear:` (e.g. `ENG-123`)     |
| Linear comment | `linear-comment:`              |
| Calendar event | `gcal:`                          |
| Vault note     | `note:` (filename without `.md`)  |

Embed the key as an HTML comment on each bullet so future runs can grep:
`- [ ] ... `

When appending, read the existing file, extract all `` markers, and skip any new item whose key already exists.

---

## File templates

### `mentions.md`

```markdown
# Mentions — 

## Gmail

- [ ] **** — from  —  — [open]() 

## Slack — channel mentions

- [ ] **#** — : "" —  — [open](permalink) 

## Slack — group mentions

- [ ] **** — : "" —  — [open](permalink) 

## Slack — DMs (24h)

- [ ] ****: "" —  — [open](permalink) 
```

### `topics.md`

```markdown
# Hot topics — 

> Channels: #, #, # (from `_config.json`)

## #

- **** —  replies,  reactions — started by   — [open](permalink) 
```

### `linear.md`

```markdown
# Linear — 

## Assigned to me — open

- [ ] ****  —  —  — [open](url) 

## Mentions (48h)

-  on **** : "" —  — [open]() 
```

### `calendar.md`

```markdown
# Calendar — next 48h, as of  

- **** () —  —  attendees — [open]() 
```

### `notes.md`

Snapshot of every `wiki/notes/*.md` with `status: open` (sweep already removed expired). Regenerated whole each run — not append-dedup.

```markdown
# Notes —  

> Live snapshot of `wiki/notes/` — vault TTL 7d. Manage with `/note`, `/task`, or `/note done `.

## Active Tasks

- [ ] **** — assignee  — due  —  — [open](obsidian://open?vault=digital-brain&file=notes%2F) 

## Active Reminders

- [ ] **** — due  — [open](obsidian://open?vault=digital-brain&file=notes%2F) 
```

If a section is empty, write the header with `_none_`.

---

## Chat output (after writing)

**Lead with a Top-10 table.** Persistence still happens in the four files; the chat output is for triage. Use this shape:

```
Synced . Wrote/updated:
  - wiki/daily//mentions.md  ( new)
  - wiki/daily//topics.md    ( new)
  - wiki/daily//linear.md    ( new)
  - wiki/daily//calendar.md  ( new)
  - wiki/daily//notes.md     ( active ·  expired this sweep)

### Top 10
| # | Priority | Source            | Item                                    | Deadline / age   | Action            |
| - | -------- | ----------------- | --------------------------------------- | ---------------- | ----------------- |
| 1 | 🔥       | Slack group DM    | Dan: review red-team demo video         | by 16:00 today   | Watch + post take |
| … | …        | …                 | …                                       | …                | …                 |

### Counts (full detail in the daily files)
- Gmail:  threads · Slack channel mentions:  · Slack DMs:  · Linear assigned:  open · Calendar:  next 48h · Notes:  active ( tasks,  reminders;  expired this sweep)
```

**Top-10 selection rules** (same as `/sup`):

- Drop `notifications@linear.app`, `notifications@mixmax.com`, `notifications@shapes.co`, `aws-marketing-email-replies@amazon.com`, and any "calendar invitation accepted/declined" emails — they don't get rows even though they still land in `mentions.md` for the historical record.
- If a Linear mention already appears in the table, do NOT also add the matching Linear notification email.
- Slack DMs only earn a row if they ask for a decision, review, or name a deadline. Reaction emojis, links, "ok"/"thanks"/"got it", and banter never get a row.
- Use 🔥 for hard deadlines in next 4h, **High** for explicit asks-of-you in last 24h, **Med** for older / context items.
- **Notes earn rows.** Every `note_kind: task` with `status: open` always gets a row (source: `Note (task)`). `note_kind: reminder` gets a row only if `due ≤ now + 24h` (source: `Note (reminder)`). Score 🔥 if `due ≤ now + 4h`, High otherwise. If a note has a `linear` ID and the matching Linear issue already appears in the table, dedupe — keep one row (prefer the note row, since it carries your own framing).

Be terse: title + 1-line context + link per item in the table. Do not paste full message bodies in chat — the daily files already have the full detail.

---

## Failure modes

- **No MCP for a source** (e.g. Gmail not authenticated): skip that source, note `(skipped: not authenticated)` in chat output. Do not block the rest.
- **Rate limit / API error**: log it, continue with what you have.
- **No items in a section**: still write the section header with `_none_` so future updates have an anchor.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [eliransu](https://github.com/eliransu)
- **Source:** [eliransu/digital-brain](https://github.com/eliransu/digital-brain)
- **License:** MIT
- **Homepage:** https://github.com/eliransu/digital-brain

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-eliransu-digital-brain-sync
- Seller: https://agentstack.voostack.com/s/eliransu
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
