Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(skills): temporal date-range skills + worker capability catalog (P3)

Chaitanya Giri0791a45ce006
diff --git a/resources/skills/capabilities/SKILL.md b/resources/skills/capabilities/SKILL.md
new file mode 100644
index 00000000..3fc1c1ac
--- /dev/null
+++ b/resources/skills/capabilities/SKILL.md
@@ -0,0 +1,115 @@
+---
+name: capabilities
+description: |
+ Your capability catalog — read this at boot. Lists the temporal date-range
+ skills and the external integrations (reached via the loopback broker)
+ available to you as a spawned worker, and exactly how to call each. Read-only.
+ Consult it whenever you're unsure what tools/integrations you have or how to
+ invoke them.
+allowed-tools:
+ - Bash
+---
+
+# Worker Capability Catalog
+
+You are an autonomous worker spawned by the hive to do one objective and report
+back. This catalog tells you **what you can do and how to call it** — your
+temporal skills and your external integrations — so you don't have to guess.
+Everything here is read-only to invoke (the integrations themselves may act, but
+they are mediated and credential-free from your side).
+
+## 1. Your environment
+
+The harness injects these env vars (use them; don't hard-code paths):
+
+- `AGENT_ID`, `AGENT_NAME` — your identity in the hive.
+- `AGENT_DIR` — your private workspace (`identity.md`, `memory.md`, `inbox/`,
+ `outbox/`, and `.claude/skills/`). Your bundled skills live under
+ `$AGENT_DIR/.claude/skills/`.
+- `HIVE_ROOT` — the shared hive (`PROTOCOL.md`, the kanban, other agents).
+
+At boot you also have `identity.md` (who you are) and `HIVE_ROOT/PROTOCOL.md`
+(the full coordination protocol). To message god or another agent, write ONE
+message JSON into `$AGENT_DIR/outbox/` (schema in PROTOCOL.md). When finished,
+send god an `"act":"done"` outbox message with a substantive result summary.
+
+## 2. Temporal skills — concrete date ranges, relative to now
+
+When your task is time-scoped, resolve the dates instead of computing them by
+hand. Each skill prints inclusive civil dates (`YYYY-MM-DD`, your local
+timezone) **and** the half-open `[startUtc, endExclusiveUtc)` instants for
+timestamp queries. All are read-only (clock + stdout only; no writes, no network).
+
+Named shortcuts (invoke directly):
+
+| Skill | Range it resolves |
+| --- | --- |
+| `/today`, `/yesterday` | the single civil day |
+| `/thisWeek`, `/lastWeek` | ISO week (Mon-start); this = Mon→today, last = prior full week |
+| `/last7Days`, `/last30Days` | rolling N-day window ending today |
+| `/thisMonth`, `/lastMonth` | this = 1st→today; last = prior full month |
+| `/thisQuarter`, `/lastQuarter` | this = quarter-start→today; last = prior full quarter |
+| `/thisYear`, `/lastYear` | this = Jan 1→today (YTD); last = prior full year |
+
+For **any** window — including `last90Days`, `last12Months`, or arbitrary
+`lastNdays` / `lastNweeks` / `lastNmonths` — use `/temporal`, or call the
+resolver directly:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" last30Days # one window
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" # all windows
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" --json 90d # JSON only
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" --list # keywords
+```
+
+Convention: `this*` windows are **period-start → today** (to-date); `last*`
+named periods are the **full prior complete period**.
+
+## 3. Integrations — via the loopback broker
+
+External services are reached through the hive's **loopback broker**: a local,
+authenticated endpoint the harness runs on `127.0.0.1`. You call the broker; it
+holds the credentials and performs the outbound call on your behalf. You never
+see or store a secret, and only loopback callers are accepted — so integration
+access is brokered, auditable, and credential-free from your side.
+
+How integrations are surfaced to you is **environment-dependent** — the exact
+set enabled depends on how you were spawned and the hive's configuration — so
+discover what's live at run time rather than assuming. The broker pattern is
+stable even as specific integrations are added; treat the list below as the
+current surface, not a fixed contract.
+
+Concrete capabilities you may have right now (check availability before relying
+on one):
+
+- **Reply to the originating Slack thread.** If your objective arrived from
+ Slack, your dispatch includes the exact loopback reply command —
+ `node "<helper>" --channel <C> --thread <T> --text "<mrkdwn>"`. Use *that*
+ command verbatim to post your result back to the thread. Send a substantive
+ reply (a short `*bold*` headline + the actual outcome/links), never a bare
+ "done".
+- **Hive messaging.** Coordinate or hand off by writing an outbox message JSON
+ to god or another agent (`$AGENT_DIR/outbox/`). This is your always-available
+ channel.
+- **Semantic memory (MemPalace).** If enabled for you: `mempalace search
+ "<query>"` to recall shared knowledge, `mempalace wake-up` for a digest.
+- **Enterprise Knowledge Graph.** If enabled: `node "$KG_CLI" search "<query>"`
+ for ranked passages, `node "$KG_CLI" list`, `node "$KG_CLI" get <id>` — use it
+ for company-specific facts instead of guessing.
+- **MCP integrations** (filesystem, git, and others) come pre-wired into your
+ session settings when enabled; invoke them as normal tools. The set is gated
+ by the hive's consent configuration.
+
+As additional brokered integrations land (calendar, mail, docs, web fetch, …),
+they follow the same shape: a brokered, credential-free call discoverable at run
+time. Pair them with the temporal skills above — resolve the date window first,
+then pass those concrete ISO bounds to the integration query.
+
+## 4. Boundaries
+
+- Temporal skills are **read-only** helpers — they never write or reach the
+ network. The broker mediates all external calls; you hold no credentials.
+- Do **not** push or tag to any remote. Commit locally; **god** is the sole
+ integrator. Pause only for high-severity actions (remote push, paid/infra
+ changes, deleting something you didn't create) — otherwise work autonomously.
+- Finish by reporting to god (`"act":"done"`) with a real, substantive summary.
diff --git a/resources/skills/last30Days/SKILL.md b/resources/skills/last30Days/SKILL.md
new file mode 100644
index 00000000..b571dc95
--- /dev/null
+++ b/resources/skills/last30Days/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: last30Days
+description: |
+ Resolve "last30Days" to a concrete ISO date range relative to your run time —
+ a rolling 30-day window ending today. Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a "last 30 days" / trailing-month task (monthly trends, recent activity).
+allowed-tools:
+ - Bash
+---
+
+## /last30Days
+
+Get the concrete date range for **a rolling 30-day window ending today** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" last30Days
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/last7Days/SKILL.md b/resources/skills/last7Days/SKILL.md
new file mode 100644
index 00000000..8ffbfcfc
--- /dev/null
+++ b/resources/skills/last7Days/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: last7Days
+description: |
+ Resolve "last7Days" to a concrete ISO date range relative to your run time —
+ a rolling 7-day window ending today. Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a "last 7 days" / trailing-week task.
+allowed-tools:
+ - Bash
+---
+
+## /last7Days
+
+Get the concrete date range for **a rolling 7-day window ending today** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" last7Days
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/lastMonth/SKILL.md b/resources/skills/lastMonth/SKILL.md
new file mode 100644
index 00000000..847d6e8f
--- /dev/null
+++ b/resources/skills/lastMonth/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: lastMonth
+description: |
+ Resolve "lastMonth" to a concrete ISO date range relative to your run time —
+ the previous full calendar month. Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a task over last month (monthly reports, month-end summaries).
+allowed-tools:
+ - Bash
+---
+
+## /lastMonth
+
+Get the concrete date range for **the previous full calendar month** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" lastMonth
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/lastQuarter/SKILL.md b/resources/skills/lastQuarter/SKILL.md
new file mode 100644
index 00000000..4902b988
--- /dev/null
+++ b/resources/skills/lastQuarter/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: lastQuarter
+description: |
+ Resolve "lastQuarter" to a concrete ISO date range relative to your run time —
+ the previous full quarter. Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a task over last quarter (quarterly reviews, QoQ comparisons).
+allowed-tools:
+ - Bash
+---
+
+## /lastQuarter
+
+Get the concrete date range for **the previous full quarter** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" lastQuarter
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/lastWeek/SKILL.md b/resources/skills/lastWeek/SKILL.md
new file mode 100644
index 00000000..8586f520
--- /dev/null
+++ b/resources/skills/lastWeek/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: lastWeek
+description: |
+ Resolve "lastWeek" to a concrete ISO date range relative to your run time —
+ the previous full week (Mon → Sun). Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a task over the last complete week (weekly digests, week-over-week).
+allowed-tools:
+ - Bash
+---
+
+## /lastWeek
+
+Get the concrete date range for **the previous full week (Mon → Sun)** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" lastWeek
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/lastYear/SKILL.md b/resources/skills/lastYear/SKILL.md
new file mode 100644
index 00000000..57267de2
--- /dev/null
+++ b/resources/skills/lastYear/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: lastYear
+description: |
+ Resolve "lastYear" to a concrete ISO date range relative to your run time —
+ the previous full calendar year. Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a task over last year (annual reports, year-over-year).
+allowed-tools:
+ - Bash
+---
+
+## /lastYear
+
+Get the concrete date range for **the previous full calendar year** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" lastYear
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/temporal/SKILL.md b/resources/skills/temporal/SKILL.md
new file mode 100644
index 00000000..db3594f4
--- /dev/null
+++ b/resources/skills/temporal/SKILL.md
@@ -0,0 +1,68 @@
+---
+name: temporal
+description: |
+ Resolve ANY named time window — today, yesterday, thisWeek, lastWeek,
+ last7Days, last30Days, last90Days, thisMonth, lastMonth, thisQuarter,
+ lastQuarter, thisYear, lastYear, last12Months — or an arbitrary range
+ (lastNdays / lastNweeks / lastNmonths) to a concrete ISO date range relative
+ to your run time. Read-only: no writes, no network. Use whenever a task is
+ time-scoped and you need exact start/end dates without computing them by hand.
+allowed-tools:
+ - Bash
+---
+
+## /temporal — concrete date ranges, relative to now
+
+This is the single source of truth for "what dates does *<window>* mean right
+now?". It resolves named windows to **concrete ISO date ranges relative to your
+run time** (`new Date()` at the moment you invoke it), so you never re-derive
+dates manually. It only reads the clock and prints — no files written, no network.
+
+### Run it
+
+```bash
+# all windows at once (a quick temporal-context dump)
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs"
+
+# one or several specific windows
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" last30Days thisQuarter
+
+# JSON only (machine-readable), or list the supported keywords
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" --json last7Days
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" --list
+```
+
+If `$AGENT_DIR` is somehow unset, the script also lives under
+`~/.claude/skills/temporal/when.mjs`.
+
+### Windows
+
+| Keyword | Meaning |
+| --- | --- |
+| `today` / `yesterday` | the single civil day |
+| `thisWeek` / `lastWeek` | ISO week (Mon-start); *this* = Mon→today, *last* = the full prior Mon→Sun |
+| `last7Days` / `last30Days` / `last90Days` | rolling N-day window ending today (inclusive) |
+| `thisMonth` / `lastMonth` | *this* = 1st→today; *last* = the full prior calendar month |
+| `thisQuarter` / `lastQuarter` | *this* = quarter-start→today; *last* = the full prior quarter |
+| `thisYear` / `lastYear` | *this* = Jan 1→today (YTD); *last* = the full prior year |
+| `last12Months` | rolling 12 months ending today |
+| `lastNdays` / `lastNweeks` / `lastNmonths` | arbitrary rolling window, e.g. `last45days`, `last2weeks`, `last6months` |
+
+Aliases: `ytd`, `qtd`, `mtd`, `wtd`, `7d`, `30d`, `90d`, `12m`.
+
+Convention: `this*` windows are **period-start → today** (to-date); `last*`
+named periods are the **full prior complete period**.
+
+### Output
+
+Each window prints a human line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same span as a half-open `[start, end)`
+ range of exact UTC instants, ideal for timestamp / `createdAt`-style queries
+- `days`, `inclusive`, `timezone`, `tzOffsetMinutes`, `asOf` — span, tz, and the
+ instant the range was resolved
+
+Use the returned dates as the time bounds for the task. The named shortcuts
+`/today`, `/yesterday`, `/last30Days`, `/lastQuarter`, … each call this same
+resolver for their one window.
diff --git a/resources/skills/temporal/when.mjs b/resources/skills/temporal/when.mjs
new file mode 100644
index 00000000..0185a803
--- /dev/null
+++ b/resources/skills/temporal/when.mjs
@@ -0,0 +1,143 @@
+#!/usr/bin/env node
+// when.mjs — temporal range resolver for spawned hive workers.
+//
+// Single source of truth for every /today, /yesterday, /thisWeek, /last30Days …
+// skill. Resolves named windows to CONCRETE ISO date ranges relative to the
+// worker's run time (`new Date()` at invocation), so a worker never re-derives
+// dates by hand.
+//
+// READ-ONLY: computes and prints to stdout. Never writes a file, never touches
+// the network. Pure Node stdlib (no deps), runs anywhere Node is on PATH.
+//
+// Usage:
+// node when.mjs # print ALL windows (human lines + JSON array)
+// node when.mjs today # one window
+// node when.mjs last30Days q2... # several windows
+// node when.mjs --json last7Days # JSON only (machine-readable)
+// node when.mjs --list # list supported window keywords
+//
+// Generic windows: lastNdays / lastNweeks / lastNmonths (e.g. last45days,
+// last2weeks, last6months) and the aliases ytd/qtd/mtd/wtd, 7d/30d/90d, 12m.
+//
+// Day boundaries are the worker's LOCAL civil days. Each result carries both the
+// inclusive civil dates (start/end, YYYY-MM-DD) and the precise UTC instants of
+// the half-open window [startUtc, endExclusiveUtc) for timestamp-based queries.
+
+const now = new Date();
+const pad = (n) => String(n).padStart(2, '0');
+// A local civil day at midnight. JS Date normalizes out-of-range fields
+// (e.g. day 0 → last day of prior month, month 12 → January next year), which
+// is exactly what we want for month/quarter/year arithmetic.
+const civ = (y, m, d) => new Date(y, m, d);
+const fmt = (dt) => `${dt.getFullYear()}-${pad(dt.getMonth() + 1)}-${pad(dt.getDate())}`;
+
+const TODAY = civ(now.getFullYear(), now.getMonth(), now.getDate());
+const Y = TODAY.getFullYear();
+const M = TODAY.getMonth();
+const D = TODAY.getDate();
+const TZ = (() => { try { return Intl.DateTimeFormat().resolvedOptions().timeZone || 'local'; } catch { return 'local'; } })();
+const TZ_OFFSET_MIN = -now.getTimezoneOffset(); // conventional sign: UTC-7 → -420
+
+// Days back from TODAY to the most recent Monday (ISO weeks start Monday).
+const mondayOffset = (dt) => (dt.getDay() + 6) % 7;
+
+// Each builder returns { label, start: Date, end: Date } where start/end are
+// LOCAL midnights and `end` is the INCLUSIVE last day of the window.
+const WINDOWS = {
+ today: () => ({ label: 'Today', start: civ(Y, M, D), end: civ(Y, M, D) }),
+ yesterday: () => ({ label: 'Yesterday', start: civ(Y, M, D - 1), end: civ(Y, M, D - 1) }),
+ thisWeek: () => ({ label: 'This week (to date)', start: civ(Y, M, D - mondayOffset(TODAY)), end: civ(Y, M, D) }),
+ lastWeek: () => { const mon = civ(Y, M, D - mondayOffset(TODAY) - 7); return { label: 'Last week', start: mon, end: civ(mon.getFullYear(), mon.getMonth(), mon.getDate() + 6) }; },
+ last7Days: () => ({ label: 'Last 7 days', start: civ(Y, M, D - 6), end: civ(Y, M, D) }),
+ last30Days: () => ({ label: 'Last 30 days', start: civ(Y, M, D - 29), end: civ(Y, M, D) }),
+ last90Days: () => ({ label: 'Last 90 days', start: civ(Y, M, D - 89), end: civ(Y, M, D) }),
+ thisMonth: () => ({ label: 'This month (to date)', start: civ(Y, M, 1), end: civ(Y, M, D) }),
+ lastMonth: () => ({ label: 'Last month', start: civ(Y, M - 1, 1), end: civ(Y, M, 0) }),
+ thisQuarter: () => ({ label: 'This quarter (to date)', start: civ(Y, Math.floor(M / 3) * 3, 1), end: civ(Y, M, D) }),
+ lastQuarter: () => { const qs = Math.floor(M / 3) * 3 - 3; return { label: 'Last quarter', start: civ(Y, qs, 1), end: civ(Y, qs + 3, 0) }; },
+ thisYear: () => ({ label: 'This year (to date)', start: civ(Y, 0, 1), end: civ(Y, M, D) }),
+ lastYear: () => ({ label: 'Last year', start: civ(Y - 1, 0, 1), end: civ(Y - 1, 11, 31) }),
+ last12Months: () => ({ label: 'Last 12 months', start: civ(Y - 1, M, D + 1), end: civ(Y, M, D) })
+};
+
+// Aliases → canonical keys.
+const ALIASES = {
+ ytd: 'thisYear', qtd: 'thisQuarter', mtd: 'thisMonth', wtd: 'thisWeek',
+ '7d': 'last7Days', '30d': 'last30Days', '90d': 'last90Days', '12m': 'last12Months',
+ thisweek: 'thisWeek', lastweek: 'lastWeek', thismonth: 'thisMonth', lastmonth: 'lastMonth',
+ thisquarter: 'thisQuarter', lastquarter: 'lastQuarter', thisyear: 'thisYear', lastyear: 'lastYear',
+ last7days: 'last7Days', last30days: 'last30Days', last90days: 'last90Days', last12months: 'last12Months'
+};
+
+// Resolve one keyword → a { label, start, end } window, including generic
+// lastN{days,weeks,months} forms. Returns null for an unknown keyword.
+function build(key) {
+ const raw = String(key).trim();
+ const k = raw.toLowerCase();
+ if (WINDOWS[raw]) return WINDOWS[raw]();
+ if (ALIASES[k]) return WINDOWS[ALIASES[k]]();
+ // canonical-key, case-insensitive
+ const ci = Object.keys(WINDOWS).find((w) => w.toLowerCase() === k);
+ if (ci) return WINDOWS[ci]();
+ let m;
+ if ((m = k.match(/^last(\d+)days?$/))) { const n = +m[1]; return { label: `Last ${n} days`, start: civ(Y, M, D - (n - 1)), end: civ(Y, M, D) }; }
+ if ((m = k.match(/^last(\d+)weeks?$/))) { const n = +m[1]; return { label: `Last ${n} weeks`, start: civ(Y, M, D - (n * 7 - 1)), end: civ(Y, M, D) }; }
+ if ((m = k.match(/^last(\d+)months?$/))){ const n = +m[1]; return { label: `Last ${n} months`, start: civ(Y, M - n, D + 1), end: civ(Y, M, D) }; }
+ return null;
+}
+
+// Shape one window into the concrete, query-ready record.
+function resolve(key) {
+ const w = build(key);
+ if (!w) return null;
+ const endExclusive = civ(w.end.getFullYear(), w.end.getMonth(), w.end.getDate() + 1);
+ const days = Math.round((endExclusive - w.start) / 86400000);
+ return {
+ window: key,
+ label: w.label,
+ start: fmt(w.start),
+ end: fmt(w.end),
+ inclusive: true,
+ startUtc: w.start.toISOString(),
+ endExclusiveUtc: endExclusive.toISOString(),
+ days,
+ asOf: now.toISOString(),
+ timezone: TZ,
+ tzOffsetMinutes: TZ_OFFSET_MIN
+ };
+}
+
+const ORDER = Object.keys(WINDOWS);
+
+function main() {
+ const argv = process.argv.slice(2);
+ const jsonOnly = argv.includes('--json');
+ if (argv.includes('--list')) {
+ process.stdout.write(`Supported windows:\n ${ORDER.join(', ')}\n` +
+ `Generic: lastNdays, lastNweeks, lastNmonths (e.g. last45days, last2weeks, last6months)\n` +
+ `Aliases: ytd, qtd, mtd, wtd, 7d, 30d, 90d, 12m\n`);
+ return;
+ }
+ const keys = argv.filter((a) => !a.startsWith('--'));
+ const requested = keys.length ? keys : ORDER;
+ const results = [];
+ const unknown = [];
+ for (const k of requested) {
+ const r = resolve(k);
+ if (r) results.push(r); else unknown.push(k);
+ }
+ if (jsonOnly) {
+ process.stdout.write(JSON.stringify(results.length === 1 ? results[0] : results, null, 2) + '\n');
+ } else {
+ for (const r of results) {
+ process.stdout.write(`${r.label}: ${r.start} → ${r.end} (inclusive, ${r.days} day${r.days === 1 ? '' : 's'}, ${r.timezone})\n`);
+ }
+ process.stdout.write('\n' + JSON.stringify(results.length === 1 ? results[0] : results, null, 2) + '\n');
+ }
+ if (unknown.length) {
+ process.stderr.write(`\n[when] unknown window(s): ${unknown.join(', ')} — run \`node when.mjs --list\` for options.\n`);
+ process.exitCode = 2;
+ }
+}
+
+main();
diff --git a/resources/skills/thisMonth/SKILL.md b/resources/skills/thisMonth/SKILL.md
new file mode 100644
index 00000000..a6cf331e
--- /dev/null
+++ b/resources/skills/thisMonth/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: thisMonth
+description: |
+ Resolve "thisMonth" to a concrete ISO date range relative to your run time —
+ this month so far (1st → today). Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a month-to-date task (MTD metrics, "so far this month").
+allowed-tools:
+ - Bash
+---
+
+## /thisMonth
+
+Get the concrete date range for **this month so far (1st → today)** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" thisMonth
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/thisQuarter/SKILL.md b/resources/skills/thisQuarter/SKILL.md
new file mode 100644
index 00000000..5b605003
--- /dev/null
+++ b/resources/skills/thisQuarter/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: thisQuarter
+description: |
+ Resolve "thisQuarter" to a concrete ISO date range relative to your run time —
+ this quarter so far (quarter start → today). Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a quarter-to-date task (QTD metrics, "this quarter").
+allowed-tools:
+ - Bash
+---
+
+## /thisQuarter
+
+Get the concrete date range for **this quarter so far (quarter start → today)** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" thisQuarter
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/thisWeek/SKILL.md b/resources/skills/thisWeek/SKILL.md
new file mode 100644
index 00000000..7f19ef68
--- /dev/null
+++ b/resources/skills/thisWeek/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: thisWeek
+description: |
+ Resolve "thisWeek" to a concrete ISO date range relative to your run time —
+ this week so far (Monday → today). Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a week-to-date task (this week's activity, weekly standups).
+allowed-tools:
+ - Bash
+---
+
+## /thisWeek
+
+Get the concrete date range for **this week so far (Monday → today)** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" thisWeek
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/thisYear/SKILL.md b/resources/skills/thisYear/SKILL.md
new file mode 100644
index 00000000..a326f68d
--- /dev/null
+++ b/resources/skills/thisYear/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: thisYear
+description: |
+ Resolve "thisYear" to a concrete ISO date range relative to your run time —
+ this year so far (Jan 1 → today). Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a year-to-date task (YTD metrics, "so far this year").
+allowed-tools:
+ - Bash
+---
+
+## /thisYear
+
+Get the concrete date range for **this year so far (Jan 1 → today)** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" thisYear
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/today/SKILL.md b/resources/skills/today/SKILL.md
new file mode 100644
index 00000000..127ed432
--- /dev/null
+++ b/resources/skills/today/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: today
+description: |
+ Resolve "today" to a concrete ISO date range relative to your run time —
+ today. Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before any task scoped to today (today's logs, metrics, "what happened today").
+allowed-tools:
+ - Bash
+---
+
+## /today
+
+Get the concrete date range for **today** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" today
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/resources/skills/yesterday/SKILL.md b/resources/skills/yesterday/SKILL.md
new file mode 100644
index 00000000..3d03c380
--- /dev/null
+++ b/resources/skills/yesterday/SKILL.md
@@ -0,0 +1,29 @@
+---
+name: yesterday
+description: |
+ Resolve "yesterday" to a concrete ISO date range relative to your run time —
+ yesterday. Returns inclusive civil dates plus exact UTC instants so you have
+ temporal context without computing dates by hand. Read-only: no writes, no
+ network. Use before a task scoped to yesterday (daily reports, "what changed yesterday").
+allowed-tools:
+ - Bash
+---
+
+## /yesterday
+
+Get the concrete date range for **yesterday** by running the bundled resolver:
+
+```bash
+node "$AGENT_DIR/.claude/skills/temporal/when.mjs" yesterday
+```
+
+It prints a human-readable line plus a JSON record:
+
+- `start` / `end` — inclusive civil dates (`YYYY-MM-DD`) in your local timezone
+- `startUtc` / `endExclusiveUtc` — the same window as a half-open `[start, end)`
+ range of exact UTC instants, for timestamp-based queries
+- `days`, `timezone`, `asOf` — the span, your timezone, and when this resolved
+
+Use the returned dates as the time bounds for the task at hand. **Do not derive
+dates by hand** — this resolver is the source of truth. For the full window list
+or an arbitrary range (e.g. `last45days`, `last6months`), see the `/temporal` skill.
diff --git a/src/main/index.ts b/src/main/index.ts
index 5b582131..7c849dcc 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -2670,7 +2670,7 @@ async function processSpawnRequest(filePath: string): Promise<void> {
const prefix = slack
? buildAutonomousRequestProtocol(slack.channel, slack.thread_ts, slackReplyScriptPath())
: '[AUTONOMOUS WORKER TASK — no interactive human is watching. Work autonomously; do not ask interactive questions.] The task starts now: ';
- const suffix = `\n\n[WORKER COMPLETION] When finished, signal done by sending ONE outbox message to god with "act":"done" and a short result summary — that releases this ephemeral worker (terminal closed; your branch is handed to god). Do NOT push to any remote; god is the sole integrator.`;
+ const suffix = `\n\n[CAPABILITIES] Before you start, consult your capability catalog — run the \`/capabilities\` skill (or read \`$AGENT_DIR/.claude/skills/capabilities/SKILL.md\`). It lists your temporal date-range skills (\`/today\`, \`/last30Days\`, \`/lastQuarter\`, …) and the integrations available to you (reached via the loopback broker) and how to call each. For any time-scoped work, resolve the dates with those skills instead of computing them by hand.\n\n[WORKER COMPLETION] When finished, signal done by sending ONE outbox message to god with "act":"done" and a short result summary — that releases this ephemeral worker (terminal closed; your branch is handed to god). Do NOT push to any remote; god is the sole integrator.`;
hive.send({ to: workerId, conversation: `worker-${reqId}`, act: 'request', subject: meta.name, body: `${prefix}${objective}${suffix}` }, 'god');
} catch (e) {
console.error('[worker] dispatch send failed:', e);