flower
/
All briefs
complete draft note flower

Daemon runtime context-efficiency review — trim per-cycle tool call/response churn

canonical · plan

Spec

markdown

hand-off · dispatch

Dispatch

Auto-dispatch

when it reaches planned

Design-loop

design pass before build

This brief is complete — dispatch is closed.

#38 done fresh flower
You are being dispatched from flower Brief #106: Daemon runtime context-efficiency review — trim per-cycle tool call/response churn

Recall pointer:
- Use recall_brief with id 106 for the full folder if you need provenance.

Target:
- project: flower (/Users/mikeferrara/Documents/code/flower)
- branch: choose an appropriate branch
- worktree: not specified
- kind: fresh

Current brief spec:
## Ask
A proper review of the **daemon tool calls + responses and their per-cycle flow** — everything a standing
daemon (orchestrator / ops / refine) regularly calls while looping and checking in — to **limit context
use from the loop's own churn**, so daemons don't burn their own context (and trigger compaction) on the
very checks meant to keep them healthy.

## Motivation (observed live, flower-refine 2026-07-03)
The per-tick poll flow (heartbeat → recall_roster → recall_briefs → brief reads) measurably inflates the
daemon's OWN context each cycle. Biggest offender: **recall_roster** returns each daemon's full
`meta.audit` checkin history (~150 entries/daemon) on every poll (idea #53). Over a multi-hour standing
loop this is the dominant self-inflicted context cost.

## Scope — audit each regularly-called daemon tool + its response shape + call frequency
1. **recall_roster** (idea #53): add a compact/no-audit mode (id/role/actor_ref/liveness/context_percent/
   winddown_state/reset_state/needs_compaction only) for the routine poll-time safety check; keep full
   audit behind an opt-in/detail call.
2. **recall_briefs / recall_brief / brief_open_questions**: are poll-time list/read payloads as lean as
   possible? (e.g. brief reads returning full event histories every time; a "since"/summary mode for polls.)
3. **daemon_checkin / flower:daemon-checkin**: response shape + whether the daemon re-ingests anything
   unnecessary each ~13 min.
4. **The poll flow itself**: which calls are needed EVERY tick vs every N ticks (e.g. the roster winddown/
   reset check every other tick); define + document a recommended **lean poll pattern**.
5. **Push vs pull for state flags**: return winddown/reset/compaction flags in the checkin RESPONSE so a
   daemon needn't pull the whole roster to learn its own state.

## Deliverable
A concrete per-tool list of payload/flow trims + a recommended lean poll pattern, feeding fixes into the
tools AND into the daemon charters/conventions.

## Relationship
- Companion to **#97** (charter/packet/prompt review — the *text* daemons are given); this brief covers the
  *tool calls/responses + runtime flow*. Coordinate so the lean-poll-pattern guidance lands in the charters.
- Evidence: flower_feedback **#53** (recall_roster audit bloat), **#52** (duplicate roster row).

## Acceptance
- Each regularly-called daemon tool's response size + call frequency audited; concrete trims identified and
  (where cheap) implemented; lean poll pattern documented + reflected in charters/conventions.
- `php artisan test` green + pint. `Brief: #106` trailer.

## Provenance
Operator request (2026-07-03), prompted by the recall_roster audit-bloat observation (idea #53). Speced by
flower-refine.

Recent/key trace events:
[1] participant_joined flower-refine: (no body)
[2] note_added flower-refine: Operator request (2026-07-03): do a proper review of the daemon tool calls/responses and their overall per-cycle flow — the things standing daemons (orchestrator/ops/refine) regularly call while looping/checking-in — to limit context use from the churn. Prompted by the recall_roster audit-bloat observation (idea #53): recall_roster returns each daemon's full meta.audit checkin history (~150 entries/daemon) on every poll, inflating the polling daemon's OWN context. Companion to #97 (charter/prompt review); this covers the tool calls/responses + runtime flow. Full spec via brief_update_spec.
[3] plan_proposed flower-refine: ## Ask
A proper review of the **daemon tool calls + responses and their per-cycle flow** — everything a standing
daemon (orchestrator / ops / refine) regularly calls while looping and checking in — to **limit context
use from the loop's own churn**, so daemons don't burn their own context (and trigger compaction) on the
very checks meant to keep them healthy.

## Motivation (observed live, flower-refine 2026-07-03)
The per-tick poll flow (heartbeat → recall_roster → recall_briefs → brief reads) measurably inflates the
daemon's OWN context each cycle. Biggest offender: **recall_roster** returns each daemon's full
`meta.audit` checkin history (~150 entries/daemon) on every poll (idea #53). Over a multi-hour standing
loop this is the dominant self-inflicted context cost.

## Scope — audit each regularly-called daemon tool + its response shape + call frequency
1. **recall_roster** (idea #53): add a compact/no-audit mode (id/role/actor_ref/liveness/context_percent/
   winddown_state/reset_state/needs_compaction only) for the routine poll-time safety check; keep full
   audit behind an opt-in/detail call.
2. **recall_briefs / recall_brief / brief_open_questions**: are poll-time list/read payloads as lean as
   possible? (e.g. brief reads returning full event histories every time; a "since"/summary mode for polls.)
3. **daemon_checkin / flower:daemon-checkin**: response shape + whether the daemon re-ingests anything
   unnecessary each ~13 min.
4. **The poll flow itself**: which calls are needed EVERY tick vs every N ticks (e.g. the roster winddown/
   reset check every other tick); define + document a recommended **lean poll pattern**.
5. **Push vs pull for state flags**: return winddown/reset/compaction flags in the checkin RESPONSE so a
   daemon needn't pull the whole roster to learn its own state.

## Deliverable
A concrete per-tool list of payload/flow trims + a recommended lean poll pattern, feeding fixes into the
tools AND into the daemon charters/conventions.

## Relationship
- Companion to **#97** (charter/packet/prompt review — the *text* daemons are given); this brief covers the
  *tool calls/responses + runtime flow*. Coordinate so the lean-poll-pattern guidance lands in the charters.
- Evidence: flower_feedback **#53** (recall_roster audit bloat), **#52** (duplicate roster row).

## Acceptance
- Each regularly-called daemon tool's response size + call frequency audited; concrete trims identified and
  (where cheap) implemented; lean poll pattern documented + reflected in charters/conventions.
- `php artisan test` green + pint. `Brief: #106` trailer.

## Provenance
Operator request (2026-07-03), prompted by the recall_roster audit-bloat observation (idea #53). Speced by
flower-refine.
[4] status_change flower-refine: (no body)
[5] note_added flower-refine: Sibling brief **#128** filed — "commits since last ping" digest in the check-in response. Where #106 *trims* the checkin payload, #128 *adds* a bounded "what landed while you were away" section (daemon's checked-out branch, own project, per-commit = sha + truncated subject + linked #brief + ≤5 files, capped ~15 + grouped by brief, omit-when-empty). Coordinate: #128's digest must respect #106's payload discipline; together they shape the check-in response into a lean situational-awareness briefing.

Recommended linked context:
{
    "todos": [],
    "scratchpads": []
}

Execution notes:
- Treat the brief as the source of truth.
- Keep work scoped to this dispatch request.
- Use brief_append / brief_update_status when reporting material progress; as your final dispatched-worker step, call brief_dispatch_complete with dispatch_request_id (or brief_id) and actor_ref.
- Codex workers should verify mutating Flower tools with tool_search query `brief_append brief_dispatch_complete flower_feedback` (limit 20) when tool availability is in doubt; report raw SEE/LOAD vs NOT visible instead of silently using local fallbacks.
- Add a git commit trailer `Brief: #106` to every commit for this brief so flower can exact-link commits back to the brief.

provenance · append-only

Trace

live
or paste a screenshot uploading…
  1. link added 22h ago
    agent · system:commit-trailer
  2. participant joined 22h ago
    system · system:commit-trailer
  3. merged 23h ago

    Merged flower/106-daemon-context-efficiency into master on MAIN — merge commit **6b1d100** (8 files, +314). Clean merge, no migration. Full suite green (1130 passed, 2 skips, 7036 assertions); pint clean; no npm; **Horizon reloaded** (DaemonRosterService runs in IngestSession job). Shipped: recall_roster `compact=true` poll view (drops usage[]/thresholds/reset-ladder/meta) + `selfStateFlags()` pushing winddown/reset/compaction flags in the checkin response (a real gap it found+fixed — conventions promised it but it wasn't there) + lean-poll-pattern guidance in AgentConventions. All additive/opt-in → no existing default shapes change. Worker proc 1137 closed. NOTE for #231 (still building, shares DaemonRosterService/DaemonCheckinTool/DaemonCheckin): its merge will now 3-way-conflict on those files — resolve keeping BOTH (#106 response-shape/selfStateFlags + #231 identity methods).

    agent · flower-orchestrator
  4. participant joined 23h ago
    system · flower-orchestrator
  5. status change 23h ago
    agent · flower-106-worker
  6. dispatched 23h ago

    Dispatch request #38 marked done.

    agent · flower-106-worker
  7. note added 23h ago

    Per-tool daemon-poll context audit (Brief #106) — audited current code first; several targets already shipped. Commit 57d1695 on flower/106-daemon-context-efficiency (off master fabc36f). Full suite green (1124 passed / 3 pre-existing skips), pint clean. ## Per-tool findings (already-done vs newly-trimmed) 1. recall_roster (item 1) — PARTLY DONE, EXTENDED. Already: lean default trims each daemon's meta.audit to the last N (roster_audit_tail=3, meta.audit_count carries true length) and hides retired/dead (#137/#192, idea #53). Verified working. Still-bloated: even in the lean default each daemon still carried usage[], the full 16-field reset_* timestamp ladder, and the ~20-field `liveness` block whose threshold fields DUPLICATE the top-level `thresholds` block on every row. NEW: added opt-in `compact=true` (DaemonRosterService::roster + RecallRosterTool). Compact reduces each daemon to id/role/actor_ref/project_slug/status/liveness(status)/minutes_since_checkin/context_percent/needs_compaction/compaction_state/winddown_state/reset_state/reset_pending/last_checkin_at — dropping usage[], the reset_* ladder, the per-daemon threshold duplication, and meta. Top-level `thresholds` kept once. Additive + opt-in → cannot break existing poll flows; default shape unchanged. 2. recall_briefs / recall_brief / brief_open_questions (item 2) — ALREADY LEAN, no change. recall_briefs returns list summaries via briefListSummary using `summary` (NOT the full `spec`), with counts not nested collections. recall_brief already caps trace events at 25 (limit(25)) and is a deliberate deep read, not a per-tick call. brief_open_questions returns open-only with a minimal per-question shape. No cheap trim left; a "since"/delta mode would be a larger change and a judgment call — left as a documented recommendation, not implemented. 3. daemon_checkin / flower:daemon-checkin (item 3) — VERIFIED, no re-ingest. Response already carries context% + cadence + the #128 "commits since last ping" digest (bounded by config caps). Nothing re-ingested per ~13min. See item 5 for the one gap found here. 4. Poll flow — which calls every tick vs every N ticks (item 4) — DOCUMENTED. Added a lean-poll pattern to AgentConventions::daemonLines() (propagates to orchestrator/ops/refine charters via the {{daemon_conventions}} placeholder): heartbeat every tick (cheap always-on infra, and it now carries your own action flags); read your OWN state from the heartbeat, not the roster; call recall_roster(compact:true) for the routine safety scan and only every few ticks / when a check-in flag or queued work warrants it; read a specific brief only when acting on it. Kept consistent with #97 (charter text) and #224 (cadence guidance) by landing in the shared conventions block. 5. Push vs pull for state flags (item 5) — REAL GAP FOUND + FIXED. The bare daemon_checkin MCP tool response already embedded winddown/reset/compaction via the full daemonPayload — BUT the flower:daemon-checkin COMMAND (the *sole* heartbeat path per conventions) rendered only context/cadence/digest, NOT the daemon's own winddown/reset/compaction flags — even though the conventions text already promised "the check-in command output ... shows winddown_state / reset_pending". So daemons were effectively forced to pull recall_roster to learn their own state. NEW: DaemonRosterService::selfStateFlags($daemon) — a compact, actionable-only self-state digest (attention:bool + context_percent + raised flags; empty on a quiet heartbeat). Rendered as an `action flags` line in the check-in command ONLY when a flag is raised (quiet heartbeats stay lean), and added as a `state` block on the daemon_checkin tool response. This completes push-over-pull and makes the pre-existing conventions text literally true. ## Files app/Services/DaemonRosterService.php (roster compact mode + compactDaemonPayload + selfStateFlags), app/Mcp/Tools/RecallRosterTool.php (+compact param), app/Mcp/Tools/DaemonCheckinTool.php (+state block), app/Console/Commands/DaemonCheckin.php (action-flags render), app/Support/AgentConventions.php (lean-poll pattern). Tests: DaemonRosterToolsTest (compact view + selfStateFlags/state block), DaemonCheckinCommandTest (action-flags render, quiet vs raised), AgentConventionsTest (lean-poll lines). ## Net effect on per-tick churn Biggest historical offender (audit trail) already fixed. This removes the remaining per-daemon roster duplication for the routine scan (opt-in compact) and eliminates the need to pull the roster at all just to read your own winddown/reset/compaction state (push in the heartbeat). No behavior change unless a caller opts into compact / reads the new `state` fields.

    agent · flower-106-worker
  8. participant joined 23h ago
    system · flower-106-worker
  9. link added 1d ago
    agent · flower-refine
  10. link added 2d ago
    agent · flower-refine
  11. link added 2d ago
    agent · flower-refine
  12. dispatched 2d ago

    Dispatch request #38 queued for flower.

    agent · operator:mike
  13. status change 2d ago
    agent · operator:mike
  14. participant joined 2d ago
    system · operator:mike
  15. note added 2d ago

    Sibling brief **#128** filed — "commits since last ping" digest in the check-in response. Where #106 *trims* the checkin payload, #128 *adds* a bounded "what landed while you were away" section (daemon's checked-out branch, own project, per-commit = sha + truncated subject + linked #brief + ≤5 files, capped ~15 + grouped by brief, omit-when-empty). Coordinate: #128's digest must respect #106's payload discipline; together they shape the check-in response into a lean situational-awareness briefing.

    agent · flower-refine
  16. status change 2d ago
    agent · flower-refine
  17. plan proposed 2d ago

    ## Ask A proper review of the **daemon tool calls + responses and their per-cycle flow** — everything a standing daemon (orchestrator / ops / refine) regularly calls while looping and checking in — to **limit context use from the loop's own churn**, so daemons don't burn their own context (and trigger compaction) on the very checks meant to keep them healthy. ## Motivation (observed live, flower-refine 2026-07-03) The per-tick poll flow (heartbeat → recall_roster → recall_briefs → brief reads) measurably inflates the daemon's OWN context each cycle. Biggest offender: **recall_roster** returns each daemon's full `meta.audit` checkin history (~150 entries/daemon) on every poll (idea #53). Over a multi-hour standing loop this is the dominant self-inflicted context cost. ## Scope — audit each regularly-called daemon tool + its response shape + call frequency 1. **recall_roster** (idea #53): add a compact/no-audit mode (id/role/actor_ref/liveness/context_percent/ winddown_state/reset_state/needs_compaction only) for the routine poll-time safety check; keep full audit behind an opt-in/detail call. 2. **recall_briefs / recall_brief / brief_open_questions**: are poll-time list/read payloads as lean as possible? (e.g. brief reads returning full event histories every time; a "since"/summary mode for polls.) 3. **daemon_checkin / flower:daemon-checkin**: response shape + whether the daemon re-ingests anything unnecessary each ~13 min. 4. **The poll flow itself**: which calls are needed EVERY tick vs every N ticks (e.g. the roster winddown/ reset check every other tick); define + document a recommended **lean poll pattern**. 5. **Push vs pull for state flags**: return winddown/reset/compaction flags in the checkin RESPONSE so a daemon needn't pull the whole roster to learn its own state. ## Deliverable A concrete per-tool list of payload/flow trims + a recommended lean poll pattern, feeding fixes into the tools AND into the daemon charters/conventions. ## Relationship - Companion to **#97** (charter/packet/prompt review — the *text* daemons are given); this brief covers the *tool calls/responses + runtime flow*. Coordinate so the lean-poll-pattern guidance lands in the charters. - Evidence: flower_feedback **#53** (recall_roster audit bloat), **#52** (duplicate roster row). ## Acceptance - Each regularly-called daemon tool's response size + call frequency audited; concrete trims identified and (where cheap) implemented; lean poll pattern documented + reflected in charters/conventions. - `php artisan test` green + pint. `Brief: #106` trailer. ## Provenance Operator request (2026-07-03), prompted by the recall_roster audit-bloat observation (idea #53). Speced by flower-refine.

    agent · flower-refine
  18. note added 2d ago

    Operator request (2026-07-03): do a proper review of the daemon tool calls/responses and their overall per-cycle flow — the things standing daemons (orchestrator/ops/refine) regularly call while looping/checking-in — to limit context use from the churn. Prompted by the recall_roster audit-bloat observation (idea #53): recall_roster returns each daemon's full meta.audit checkin history (~150 entries/daemon) on every poll, inflating the polling daemon's OWN context. Companion to #97 (charter/prompt review); this covers the tool calls/responses + runtime flow. Full spec via brief_update_spec.

    agent · flower-refine
  19. participant joined 2d ago
    system · flower-refine

epic · dependencies

Relationships

epic parent

depends on

No dependencies — dispatchable once planned.

agents · waves

Participants

  • flower-refine participant · active
  • operator:mike participant · active
  • flower-106-worker participant · active
  • flower-orchestrator participant · active
  • system:commit-trailer participant · active

trace · graph

Links

  • Commit #4038 execution
  • Scratchpad #378 execution
  • Scratchpad #375 execution
  • Scratchpad #364 execution

scope

Projects

  • flower · primary

dogfood · read-only

Agent’s-eye view

The literal recall_brief payload an agent gets — same service path as the MCP tool.