flower
/
All briefs
complete draft note flower

Daemon charter: make self-driven make-before-break reset the DEFAULT + raise the context ceiling to 950k rapid-handover

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.

#34 done fresh flower · flower/129-charter-self-reset-default
agent: codex
You are being dispatched from flower Brief #129: Daemon charter: make self-driven make-before-break reset the DEFAULT + raise the context ceiling to 950k rapid-handover

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

Target:
- project: flower (/Users/mikeferrara/Documents/code/flower)
- branch: flower/129-charter-self-reset-default
- worktree: not specified
- kind: fresh

Current brief spec:
(no spec yet)

This is a direct request, not a fully-specced plan. If it's clear, resolve it. If you hit a blocking ambiguity, call brief_ask (or brief_append) with your questions and flip the brief to `refining` before proceeding — don't guess.

Recent/key trace events:
[1] participant_joined flower-orchestrator: (no body)
[2] note_added flower-orchestrator: Operator directive (2026-07-03): change the standing daemon reset policy and bake it into the charter/packet so ALL future daemon spawns inherit it (not a one-off prompt).

NEW POLICY (encode in the charter text + the reset config):
1. SELF-DRIVEN RESET IS THE DEFAULT. The daemon itself decides when to reset and DRIVES its own make-before-break cycle — `daemon_request_reset` → `daemon_start_reset` (spawns successor top-level, keeps predecessor live) → successor checks in + reads handoff + `daemon_successor_ready` → predecessor `daemon_reset_handoff` (baton) → successor `daemon_retire_predecessor` (N-closes-O). Do this at an APPROPRIATE time — a natural lull with no merge/dispatch/critical work in flight — WITHOUT waiting for operator sign-off. (Previously the operator drove the take-over handshake; now it's the daemon's default responsibility.)
2. CONTEXT CEILING RAISED. The daemon MAY run context up to ~950k tokens (of the 1M window) before it MUST rapidly hand over. Prefer to reset OPPORTUNISTICALLY at a lull well before that; but ~950k is the hard "reset now, fast" line. This REPLACES the old 600k mandatory-reset threshold (600k/60% is no longer a forced reset — use judgment up to 950k). Keep a soft opportunistic band (e.g. reset at a clean lull once comfortably into the window) so a daemon isn't forced to hand over mid-work.
3. Still: report only material changes; checkpoint the operator on genuine decisions/blockers, not routine self-resets (a brief note on reset is fine).

FILES (audit first): `app/Support/DaemonCharterDefaults.php` (the canonical charter text — update the orchestrator role at minimum; apply consistently to ops/refine where the reset language lives), the reset context-threshold config (currently `reset.context_threshold_tokens` ≈ 600000 — raise the hard line to 950000; keep/add the soft/opportunistic band), the charter prompt_template (key `daemon_charter.orchestrator.default`, currently version 1) — BUMP to version 2 (is_active) via `database/seeders/PromptTemplateSeeder.php`, and RE-SEED so the live DB template row is updated (the spawn packet renders from the DB template, so the seed MUST run for the change to reach new spawns). Check `SpawnPacketService` / `SpawnDaemonBridge` to confirm the render path + any 600k references in the roster/reset code.

VERIFY: `php artisan test` green; `./vendor/bin/pint`; confirm `recall_charters(role:orchestrator)` returns the v2 body with the new reset policy after re-seed. `Brief: #<this-id>` trailer. Backend → Codex. This is the standing policy for every daemon going forward, so be precise + consistent across roles.
[3] status_change flower-orchestrator: (no body)

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: #129` 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 2d ago
    agent · system:commit-trailer
  2. participant joined 2d ago
    system · system:commit-trailer
  3. status change 2d ago
    agent · flower-backend-129
  4. dispatched 2d ago

    Dispatch request #34 marked done.

    agent · flower-backend-129
  5. note added 2d ago

    Backend worker complete on branch `flower/129-charter-self-reset-default`, commit `68f64a5` (`Update daemon charter reset policy`, trailer `Brief: #129`). Audit finding: daemon spawn packets render from active `prompt_templates` rows through `SpawnPacketService::templateFor()` (project override first, then default, highest active version). `SpawnDaemonBridge` calls `SpawnPacketService::render(..., hold: true)` for plan/spawn packets. `PromptTemplateSeeder` upserts daemon charters by `key` via `updateOrCreate`, so reseeding updates the existing default charter rows and does not duplicate them or touch unrelated template keys. The old single reset threshold lived in `config('flower.reset.context_threshold_tokens')`; runtime roster reset_pending consumers use that key as the hard rapid-handover line. Summary: encoded the two-band daemon reset policy: preferred 400k-600k self-driven reset window by default, deliberate extension toward ~950k when workload warrants, and ~950k framed as prompt rapid handover with enough margin to write the handoff if briefly overshot. Added `DaemonResetPolicy`, wired reset labels into charter rendering variables, bumped default daemon charter templates to v2/is_active, and updated runtime fallbacks/tests. Verification: `MEILISEARCH_KEY=LARAVEL-HERD ~/bin/php artisan test` ran 700 tests: 689 passed, 10 skipped, 1 expected live Anthropic sandbox/DNS error (`Tests\\Feature\\SegmentSessionTest::test_real_anthropic_call_produces_a_segment_when_key_present`, cURL error 6 resolving `api.anthropic.com`). `~/bin/php ./vendor/bin/pint app/Livewire/Roster/Show.php app/Services/DaemonRosterService.php app/Services/Daemons/SpawnPacketService.php app/Support/AgentConventions.php app/Support/DaemonCharterDefaults.php app/Support/DaemonResetPolicy.php config/flower.php tests/Feature/Daemons/DaemonResetPolicyTest.php tests/Feature/Daemons/SpawnPacketServiceTest.php tests/Feature/Mcp/DaemonRosterToolsTest.php tests/Unit/AgentConventionsTest.php` passed. MAIN re-seed command after merge: `php artisan db:seed --class=PromptTemplateSeeder`. It upserts by `prompt_templates.key` (`updateOrCreate`) and will update the default v2 charter rows without duplicating them or clobbering unrelated template keys.

    agent · flower-backend-129
  6. participant joined 2d ago
    system · flower-backend-129
  7. note added 2d ago

    REFINEMENT (operator, 2026-07-03): the ~950k hard line is "hand over PROMPTLY now," NOT a fatal cliff. Observed: Claude Code daemons at ~100% reported context could STILL write a handoff + compact — so there's genuine margin beyond 950k for the handoff itself. Charter framing: preferred 400–600k default window; deliberate extension toward ~950k when workload warrants; ~950k = "reset now, rapidly," with the note that the daemon retains the ability to write its handoff even if it briefly overshoots. Do NOT imply the system fails at the ceiling, and do NOT encourage over-conservative early resets out of fear of it. Nuance only — two-band structure stays.

    agent · flower-orchestrator
  8. note added 2d ago

    CORRECTION (operator, 2026-07-03) — the reset policy is TWO-BAND, not a single 950k threshold. Supersedes the "950k replaces 600k mandatory" wording in the original note: - PREFERRED reset window = **400k–600k tokens**: by DEFAULT the daemon resets opportunistically at a natural lull in this band (best for long-term token preservation; don't routinely run past ~600k). - EXTENSION to ~**950k**: the daemon MAY DELIBERATELY extend beyond 600k, up to a HARD ~950k rapid-handover ceiling, WHEN NEEDED — e.g. heavy queued/in-flight work where a mid-stream reset would be disruptive. Deliberate exception, NOT the default; reset at the next clean lull once extended. - ~950k = hard mandatory rapid-handover line. - Self-driven reset remains the DEFAULT (daemon drives it, no operator sign-off). Config should therefore carry BOTH a soft/preferred band (~400–600k, e.g. reset_soft/preferred threshold) AND a hard ceiling (~950k, e.g. reset_hard/max threshold) — two values. Charter text must describe the preferred-window-plus-opt-in-extension model, not a single 950k target.

    agent · flower-orchestrator
  9. dispatched 2d ago

    Dispatch request #34 queued for flower.

    agent · flower-orchestrator
  10. status change 2d ago
    agent · flower-orchestrator
  11. status change 2d ago
    agent · flower-orchestrator
  12. note added 2d ago

    Operator directive (2026-07-03): change the standing daemon reset policy and bake it into the charter/packet so ALL future daemon spawns inherit it (not a one-off prompt). NEW POLICY (encode in the charter text + the reset config): 1. SELF-DRIVEN RESET IS THE DEFAULT. The daemon itself decides when to reset and DRIVES its own make-before-break cycle — `daemon_request_reset` → `daemon_start_reset` (spawns successor top-level, keeps predecessor live) → successor checks in + reads handoff + `daemon_successor_ready` → predecessor `daemon_reset_handoff` (baton) → successor `daemon_retire_predecessor` (N-closes-O). Do this at an APPROPRIATE time — a natural lull with no merge/dispatch/critical work in flight — WITHOUT waiting for operator sign-off. (Previously the operator drove the take-over handshake; now it's the daemon's default responsibility.) 2. CONTEXT CEILING RAISED. The daemon MAY run context up to ~950k tokens (of the 1M window) before it MUST rapidly hand over. Prefer to reset OPPORTUNISTICALLY at a lull well before that; but ~950k is the hard "reset now, fast" line. This REPLACES the old 600k mandatory-reset threshold (600k/60% is no longer a forced reset — use judgment up to 950k). Keep a soft opportunistic band (e.g. reset at a clean lull once comfortably into the window) so a daemon isn't forced to hand over mid-work. 3. Still: report only material changes; checkpoint the operator on genuine decisions/blockers, not routine self-resets (a brief note on reset is fine). FILES (audit first): `app/Support/DaemonCharterDefaults.php` (the canonical charter text — update the orchestrator role at minimum; apply consistently to ops/refine where the reset language lives), the reset context-threshold config (currently `reset.context_threshold_tokens` ≈ 600000 — raise the hard line to 950000; keep/add the soft/opportunistic band), the charter prompt_template (key `daemon_charter.orchestrator.default`, currently version 1) — BUMP to version 2 (is_active) via `database/seeders/PromptTemplateSeeder.php`, and RE-SEED so the live DB template row is updated (the spawn packet renders from the DB template, so the seed MUST run for the change to reach new spawns). Check `SpawnPacketService` / `SpawnDaemonBridge` to confirm the render path + any 600k references in the roster/reset code. VERIFY: `php artisan test` green; `./vendor/bin/pint`; confirm `recall_charters(role:orchestrator)` returns the v2 body with the new reset policy after re-seed. `Brief: #<this-id>` trailer. Backend → Codex. This is the standing policy for every daemon going forward, so be precise + consistent across roles.

    agent · flower-orchestrator
  13. participant joined 2d ago
    system · flower-orchestrator

epic · dependencies

Relationships

epic parent

depends on

No dependencies — dispatchable once planned.

agents · waves

Participants

  • flower-orchestrator participant · active
  • flower-backend-129 participant · active
  • system:commit-trailer participant · active

trace · graph

Links

  • Commit #1668 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.