Skip to content

feat: wake_briefing — felt agent continuity on wake#2567

Open
chubes4 wants to merge 2 commits into
mainfrom
wake-briefing
Open

feat: wake_briefing — felt agent continuity on wake#2567
chubes4 wants to merge 2 commits into
mainfrom
wake-briefing

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented Jun 6, 2026

Summary

Implements the wake-briefing from #2557: a deterministic wake_briefing system task that composes a terse rolling-window digest of recent threshold-crossing activity and writes it to a new always-injected agent-layer memory file, WAKE.md. A fresh agent session opens already holding a glance at anything red that happened recently — closing the "no proprioception across time" gap.

Refs #2557.

What it does

On each run it reads the last N hours (default 24h, filterable) and surfaces ONLY threshold-crossing signals:

  • Repeatedly failing task types (grouped, ≥3 failures in window)
  • Stuck jobs (status=processing in window)
  • Grouped error signatures (top messages by count — never enumerated)

…then overwrites WAKE.md, which is registered as a read-only, always-injected agent-memory file so it rides into session context like SOUL/MEMORY do.

Design decisions (all from #2557, pressure-tested)

  • Stateless rolling window — NOT a last_wake timestamp. An agent is a fan-out of concurrent sessions; a single mutable wake clock is a race where the first reader resets it and blinds the others. The digest is always "last N hours", recomputed each run. Nothing to race because nothing is stored.
  • Signal discipline is the feature. Identical events are GROUPED into one line with a count (213 identical errors → one line), only threshold-crossers appear, and the empty state is a single quiet line (Nothing notable in the last 24h.), never a dashboard.
  • Deterministic — pure SQL + markdown, no AI call (cheaper than DailyMemory; no hallucination risk).
  • Pure data-machine integration over existing agents-api rails (MemoryFileRegistry / context injection policy). No substrate changes. Per the feat: wake-briefing — passive 'since last session' delta injected into agent context #2557 architecture comment: do not promote a generic digest primitive until a second consumer exists.
  • requiresAgentContext() = false — pure site-scoped maintenance, avoids the agent-context-gate failure mode fixed in data-machine-code#564.

Wiring

  • Task handler registered in SystemAgentServiceProvider::getBuiltInTasks().
  • Hourly per_agent recurring schedule, default-disabled (wake_briefing_enabled) — each agent owns its own WAKE.md because the recent-sessions pulse is agent-scoped.
  • WAKE.md registered in bootstrap.php as read-only, protected, agent_memory injection context, priority 35 (just after MEMORY.md).

Verification

  • php -l clean on all three files; phpcs clean (no violations).
  • Ran the digest queries against the live install — output renders correctly:
    - ⚠ 1 task type(s) failing repeatedly — `daily_memory_generation` ×4. Investigate?
    - ⚠ 31 error(s) logged, top signature ×25: "TaskScheduler: queued task requires agent context".
    
    Confirms grouping (25 identical errors → one line with count), thresholding (×4 surfaces, transients dropped), and the empty-state path.
  • Smoke-tested render()/truncate() in isolation; caught + fixed a multibyte bug (the ellipsis is 3 bytes, so byte-strlen overshot the visible cap — switched to mb_strlen/mb_substr so the 3-second-glance length contract holds).

Notes

  • The briefing immediately surfaced a real latent bug while testing: daily_memory_generation is failing ~4×/day. Filing separately — it's exactly the kind of thing this feature is meant to catch.
  • Default-disabled by design; enabling is opt-in per install via wake_briefing_enabled.

Constraints honored

  • Conventional commit (feat:).
  • No CHANGELOG edits, no version bumps (homeboy owns both).
  • Layer-pure: no Extra-Chill or vendor/transport names in core.

Adds WakeBriefingTask — a deterministic system task that composes a terse
rolling-window digest of recent threshold-crossing activity (repeatedly
failing task types, stuck jobs, grouped error signatures) and writes it to a
new always-injected agent-layer memory file, WAKE.md. A fresh session opens
already holding a glance at anything red that happened recently, closing the
"no proprioception across time" gap.

Design (see #2557):
- Stateless rolling window, NOT a shared last_wake timestamp. An agent is a
  fan-out of concurrent sessions; a single mutable wake clock would be a race
  where the first reader blinds the others. The digest is always "last N
  hours", recomputed each run — nothing to race because nothing is stored.
- Signal discipline is the feature: identical events are GROUPED into one line
  with a count (213 identical errors render as one line), only items crossing a
  threshold appear (repeated failures >=3), and the empty state is a single
  quiet line, never a green-checkmark dashboard.
- Deterministic: pure SQL reads + markdown formatting, no AI call.
- Pure data-machine integration over existing agents-api injection rails
  (MemoryFileRegistry / context injection policy). No substrate changes.

Wiring:
- Registers the task handler, an hourly per_agent recurring schedule
  (default-disabled, wake_briefing_enabled), and WAKE.md as a read-only,
  always-injected agent-layer memory file.
- requiresAgentContext() returns false — pure site-scoped maintenance, not an
  agent-scoped operation (avoids the data-machine-code#564 gate failure mode).

Refs #2557
@homeboy-ci
Copy link
Copy Markdown
Contributor

homeboy-ci Bot commented Jun 6, 2026

Homeboy Results — data-machine

Lint

lint — passed

ℹ️ Full options: homeboy docs commands/lint
Deep dive: homeboy lint data-machine --changed-since 8254084

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-lint-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-lint-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/27076412437

Test

test — passed

ℹ️ No impacted tests found for --changed-since 8254084
ℹ️ Run full suite if needed: homeboy test data-machine
Deep dive: homeboy test data-machine --changed-since 8254084

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-test-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-test-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/27076412437

Audit

audit — passed

  • audit — 37 finding(s)
  • Total: 37 finding(s)

Deep dive: homeboy audit data-machine --changed-since 8254084

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-audit-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-audit-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/27076412437
Tooling versions
  • Homeboy CLI: homeboy 0.222.2+416b016c
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: f6bf36dc
  • Action: unknown@unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant