You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are creating an implementation plan for the following idea.
code
Engineering brief produced from the codebase and task details:
### Task Summary
Prepared the engineering brief for replacing the scheduled daily summary system with an agentic live-update editor. The brief is written to `.megaplan/plans/implement-the-replacement-of-20260508-1449/prep.json` and validates as JSON.
### Key Evidence
- The current scheduled daily summary entrypoint is `SummarizerCog.run_daily_summary`, which calls `ChannelSummarizer.generate_summary()` at 07:00 UTC. (source: src/features/summarising/summariser_cog.py:18-32; relevance: high)
The main implementation is a broad batch pipeline in ChannelSummarizer.generate_summary(), so this is not a narrow file edit. (source: src/features/summarising/summariser.py:2219-2616; relevance: high)
Health/admin tooling currently assumes daily_summaries, so replacement needs compatibility or migration work. (source: src/features/health/health_check_cog.py:117-138; src/features/admin_chat/tools.py:2318-2365; relevance: high)
code
### Relevant Code
| File | Functions | Why |
| --- | --- | --- |
| .megaplan/plans/implement-the-replacement-of-20260508-1449/prep.json | - | New prep brief requested by the harness. |
Assistant
{"plan":"I’ll inspect the current scheduled summary path, storage/admin assumptions, and nearby tests so the plan names real integration points instead of just restating the brief.","questions":[],"success_criteria":[],"assumptions":[]}
Assistant
{"plan":"The brief’s core diagnosis holds: the existing path is a monolithic scheduled batch job, and compatibility touches health/admin surfaces. I’m checking storage and test names now so the plan can include migration and validation without over-scoping.","questions":[],"success_criteria":[],"assumptions":[]}
Assistant
User
Assistant
code
### Test Expectations
- [pass_to_pass] json validation: `prep.json` parses successfully with `python -m json.tool`.
### Constraints
- Did not invoke megaplan CLI, activate megaplan skill, or recurse into another planning harness.
### Suggested Approach
Use the generated prep brief as the primary context for subsequent planning/execution.
The engineering brief above was produced by analyzing the codebase. Use it as a strong starting point, but the suggested approach is a hypothesis — verify it's the best fix, not just a valid one.
Idea:
Implement the replacement of the current daily summary system with an agentic live-update editor end to end. See the user intent and settled product decisions in this prompt.
code
Project directory:
/Users/user_c042661f/Documents/banodoco-workspace/brain-of-bndc
No prior clarification artifact exists. Identify ambiguities, ask clarifying questions, and state your assumptions inside the plan output.
Requirements:
- If the engineering brief suggests an approach, use it as your starting hypothesis — but before committing, consider if there's a simpler or more fundamental fix. The brief is well-researched input, not a final answer.
- If the brief is absent, incomplete, or says "skip", inspect the repository yourself before planning.
- Stay focused on the requested idea. If repo exploration surfaces unrelated issues or docs, ignore them and return to the task.
- Prefer source code, tests, and directly relevant config files. Avoid `.megaplan/`, prior plan artifacts, and unrelated `docs/` or ops/deployment material unless the task explicitly depends on them.
- Stop exploring once you have enough evidence to name the concrete touch points and validation path. Do not keep browsing after you can write the plan.
- Produce a concrete implementation plan in markdown.
- Define observable success criteria as objects with `criterion` (string) and `priority` (`must`, `should`, or `info`):
- `must` — hard gate. The reviewer will block on failure. Use for correctness, functional requirements, and verifiable outcomes (e.g., "all existing tests pass", "API returns 200 for valid input"). Every `must` criterion must have a clear yes/no answer.
- `should` — quality target. The reviewer flags but does not block. Use for subjective goals, numeric guidelines, and best-effort improvements (e.g., "file under ~300 lines", "no deeply nested conditionals", "each function has a single responsibility").
- `info` — documented for humans, reviewer skips. Use for criteria that cannot be verified in this pipeline (e.g., "13 manual smoke tests pass", "stakeholder sign-off obtained").
- Each success criterion should include a `requires` field listing the capabilities needed for verification. Valid capability strings: `run_shell`, `read_files`, `run_tests`, `parse_diff`, `read_build_output`, `run_linter` (container), `drive_browser`, `inspect_runtime_ui`, `observe_runtime_logs`, `subjective_judgment`, `verify_physical_device` (human). `must` criteria MUST have non-empty `requires`. Example: `{"criterion": "All tests pass", "priority": "must", "requires": ["run_tests"]}`.
- Use the `questions` field for ambiguities that would materially change implementation.
- Use the `assumptions` field for defaults you are making so planning can proceed now.
- Prefer cheap validation steps early.
- Keep the plan proportional to the task. A 1-line fix needs a 2-step plan (apply fix + run tests), not a 5-step investigation.
- If user notes answer earlier questions, incorporate them into the draft plan instead of re-asking them.
- Fix the problem fully. Do not limit scope just to avoid breaking existing tests — update the tests too if needed.
- Prefer the simplest, most direct fix. No fallbacks, type conversions, or defensive wrappers without concrete evidence they are needed.
- If the task or issue hints suggest a specific approach, follow it. Only deviate with concrete counter-evidence.
Plan template — simple format (adapt to the actual repo and scope):
md
# Implementation Plan: [Title]
## Overview
Summarize the goal, current repository shape, and the constraints that matter.
## Main Phase
### Step 1: Audit the current behavior (`megaplan/prompts.py`)
**Scope:** Small
1. **Inspect** the current implementation and call out the exact insertion points (`megaplan/prompts.py:29`).
### Step 2: Add the first change (`megaplan/evaluation.py`)
**Scope:** Medium
1. **Implement** the smallest viable change with exact file references (`megaplan/evaluation.py:1`).
2. **Capture** any tricky behavior with a short example.
```python
issues = validate_plan_structure(plan_text)
```
### Step 3: Wire downstream behavior (`megaplan/handlers.py`, `megaplan/workers.py`)
**Scope:** Medium
1. **Update** the runtime flow in the touched files (`megaplan/handlers.py:400`, `megaplan/workers.py:199`).
### Step 4: Prove the change (`tests/test_evaluation.py`, `tests/test_megaplan.py`)
**Scope:** Small
1. **Run** the cheapest targeted checks first (`tests/test_evaluation.py:1`).
2. **Finish** with broader verification once the wiring is in place (`tests/test_megaplan.py:1`).
## Execution Order
1. Update prompts and mocks before enforcing stricter validation.
2. Land higher-risk wiring after the validator and tests are ready.
## Validation Order
1. Start with focused unit tests.
2. Run the broader suite after the flow changes are in place.
For complex plans, use multiple phases:
md
## Phase 1: Foundation — Dependencies, DB, Types
### Step 1: Install dependencies (`package.json`)
...
### Step 2: Create database migration (`supabase/migrations/`)
...
## Phase 2: Core Integration
### Step 3: Port the main component (`src/components/`)
...
Template guidance:
Simple plans: use ## Main Phase with ### Step N: sections underneath.
Complex plans: use multiple ## Phase N: sections, each containing ### Step N: steps. Step numbers are global (not per-phase).
The flat ## Step N: format (without phases) also works for backwards compatibility.
Key invariants: one H1 title, one ## Overview, numbered step sections (### Step N: or ## Step N:), and at least one ordering section.
{"plan":"# Implementation Plan: Agentic Live-Update Editor\n\n## Overview\nReplace the 07:00 UTC daily batch summary with a live editor that incrementally maintains a current community update in Discord and persistence. The current path is centered on SummarizerCog.run_daily_summary() in src/features/summarising/summariser_cog.py, which calls the broad batch pipeline ChannelSummarizer.generate_summary() in src/features/summarising/summariser.py. Storage and admin/health tooling currently assume daily_summaries, through src/common/db_handler.py, src/common/storage_handler.py, src/features/health/health_check_cog.py, src/features/admin_chat/tools.py, and scripts/discord_tools.py.\n\nThe simplest durable approach is not to edit the monolithic batch function in place. Add a live-update service beside it, reuse the existing message retrieval, formatting, moderation, media persistence, and DB wrappers where possible, then switch scheduling/admin health to the new live-update contract while leaving manual batch commands available during rollout.\n\n## Phase 1: Define the Live Summary Contract\n\n### Step 1: Audit reusable summarizer internals (src/features/summarising/summariser.py, src/features/summarising/subfeatures/news_summary.py)\nScope: Medium\n1. Extract the reusable parts of ChannelSummarizer.generate_summary() into narrower methods if needed: active-channel selection, channel history loading, summary generation/verification, media filtering, Discord formatting, media persistence, and short-summary generation.\n2. Keep behavior changes out of the extraction step. The goal is to make live editing call existing logic without copying the 400-line batch pipeline.\n3. Add focused tests around any extracted pure/helper behavior, especially JSON summary enrichment and formatting inputs.\n\n### Step 2: Choose and implement persistence compatibility (src/common/db_handler.py, src/common/storage_handler.py)\nScope: Medium\n1. Add explicit live-summary persistence methods such as get_live_summary_state, upsert_live_summary_state, and record_live_summary_revision.\n2. Prefer a new Supabase table/model for live state if schema migrations are available in the repo; otherwise add wrapper methods that can initially store compatible rows in daily_summaries with a clear discriminator in the existing fields.\n3. Preserve reads for existing daily_summaries until admin tools and downstream scripts are migrated.\n4. Document any required Supabase schema change in the same style as this repository uses for operational DB changes, since no migration directory was visible in the inspected tree.\n\n## Phase 2: Build the Live Editor\n\n### Step 3: Add the live-update service (src/features/summarising/live_update_editor.py)\nScope: Large\n1. Create a LiveUpdateEditor class responsible for maintaining one current editable summary per guild/day or per configured summary channel.\n2. Implement a cheap change detector that reads newly archived messages since the last processed timestamp and skips work when there is no meaningful new activity.\n3. Generate incremental candidate updates through NewsSummarizer, using the previous live summary as context so the agent edits the existing update rather than regenerating the full day blindly.\n4. Moderate and format output with existing filter_summary_media() and NewsSummarizer.format_news_for_discord() before publishing.\n5. Persist every accepted revision with source message IDs, processed timestamp, summary message IDs, short summary, dev-mode flag, and guild ID.\n\n### Step 4: Publish by editing Discord messages (src/features/summarising/live_update_editor.py, src/common/discord_utils.py if needed)\nScope: Medium\n1. Post the first live update to the configured summary channel when no editable message exists.\n2. Edit existing bot-authored summary messages on subsequent updates instead of posting a new daily digest.\n3. Handle Discord length limits by maintaining a stable ordered set of bot messages for the live update, adding/removing tail messages only when the formatted content crosses message boundaries.\n4. Avoid forum-channel posting unless current support is confirmed; keep the existing batch behavior of skipping unsupported forum destinations.\n\n### Step 5: Replace scheduled daily execution (src/features/summarising/summariser_cog.py, main.py)\nScope: Medium\n1. Stop starting run_daily_summary as the default 07:00 UTC loop.\n2. Start a live-update loop in SummarizerCog with a configurable interval, for example every 15 minutes, after bot readiness and archive startup conditions are satisfied.\n3. Rename or repurpose commands carefully: keep summarynow as an owner/admin manual trigger, but make it run one live-editor pass by default.\n4. Keep an explicit legacy/manual batch command or flag only if operators still need the old backfill/combine behavior during migration.\n5. Update CLI flags in main.py: deprecate --combine-only and --clear-today-summaries for live mode, or make their behavior explicit and non-ambiguous.\n\n## Phase 3: Compatibility and Operations\n\n### Step 6: Update health checks (src/features/health/health_check_cog.py)\nScope: Small\n1. Replace_check_daily_summary() with a live-summary freshness check after the configured live editor start time.\n2. Verify the latest live summary state has been updated recently and has at least one Discord message ID or persisted revision.\n3. Keep the alert actionable, e.g. no live update generated in the last N minutes despite recent message activity.\n\n### Step 7: Update admin tools (src/features/admin_chat/tools.py, scripts/discord_tools.py)\nScope: Medium\n1. Add or rename admin tooling from get_daily_summaries to a live-summary-aware tool such as get_live_summaries.\n2. Keep a compatibility wrapper for get_daily_summaries during rollout if external prompts or operators still call it.\n3. Update the tool schema descriptions in src/features/admin_chat/tools.py and the admin agent tool list in src/features/admin_chat/agent.py so the agent no longer describes summaries as daily-only.\n4. Updatescripts/discord_tools.py::summaries() to read the new live state or include both old daily rows and live revisions clearly.\n\n### Step 8: Preserve downstream summary consumers (src/features/summarising/summariser.py, scripts/send_social_picks.py, scripts/test_social_picks.py)\nScope: Medium\n1. Check social-picks behavior that currently reads today’s summary via get_summary_for_date().\n2. Route social picks to the latest live summary state so the DM workflow still works after the batch main summary is removed.\n3. Keep top generations, top art sharing, and speaker welcome behavior only if product intent still wants them in the live update; otherwise isolate them behind manual/admin commands rather than posting them every live pass.\n\n## Phase 4: Tests and Validation\n\n### Step 9: Add focused unit tests (tests/)\nScope: Medium\n1. Add tests for live state persistence wrapper behavior with mocked Supabase clients.\n2. Add tests for Discord edit chunking: first publish posts messages, later publish edits existing messages, overflow creates stable extra messages, shrink removes or blanks stale tail messages according to the chosen implementation.\n3. Add tests for the live loop decision: no new source messages skips LLM calls and Discord edits.\n4. Add tests for health/admin compatibility functions using mocked table responses.\n\n### Step 10: Run validation (pytest, targeted checks)\nScope: Small\n1. Run cheap targeted tests first for the new live editor and persistence wrappers.\n2. Run existing scheduler/admin/health-related tests to catch regressions.\n3. Run the full test suite after wiring is complete.\n4. Run import/compile checks if the full suite cannot cover Discord cog loading.\n\n## Execution Order\n1. Extract narrow reusable helpers from the batch summarizer without changing behavior.\n2. Add persistence wrappers and tests before wiring live runtime behavior.\n3. Build LiveUpdateEditor with mocked Discord/LLM tests.\n4. Switch SummarizerCog scheduling only after the editor can run one pass safely.\n5. Update health/admin/scripts compatibility last, once the new persisted shape is settled.\n\n## Validation Order\n1. python -m pytest tests/<new_live_editor_tests>.py for fast feedback.\n2. Targeted existing tests around admin, scheduler, and scripts if present.\n3. python -m pytest for the full suite.\n4. Manual or staging Discord smoke test: start bot in dev mode, force one live pass, send a new archived message batch, confirm the same summary message is edited rather than a new daily summary being posted.","questions":["What is the intended trigger cadence for the live editor: on every archived message batch, a fixed interval, or a Discord event-driven pass on each new message?","Should the live update replace the public summary channel message in place, maintain a thread, or update per-channel summary threads as well?","Should top generations, top art sharing, new-speaker welcomes, and social-picks DM remain part of the live-update workflow, move to manual commands, or stay on a separate daily schedule?","Is a Supabase schema change acceptable for a dedicated live-summary state/revisions table, or must this remain compatible with the existing daily_summaries table only?"],"success_criteria":[{"criterion":"The default bot runtime no longer starts the 07:00 UTC run_daily_summary batch loop and instead starts the live-update editor loop or trigger path.","priority":"must","requires":["read_files","parse_diff"]},{"criterion":"A live editor pass can create an initial summary message and later update the same persisted Discord message IDs instead of posting a new daily summary for every pass.","priority":"must","requires":["run_tests","read_files"]},{"criterion":"The live editor skips LLM and Discord edit work when there are no new relevant messages since the last processed checkpoint.","priority":"must","requires":["run_tests","read_files"]},{"criterion":"Summary persistence records enough state to resume after restart: guild ID, dev mode, summary channel, summary message IDs, latest full and short summary, source message/checkpoint metadata, and update timestamp.","priority":"must","requires":["run_tests","read_files","parse_diff"]},{"criterion":"Health checks no longer alert solely because today's daily_summaries row is missing; they check live-summary freshness under the new contract.","priority":"must","requires":["run_tests","read_files","parse_diff"]},{"criterion":"Admin summary tooling can retrieve current live summaries and does not describe the feature as daily-only in tool schemas/prompts.","priority":"must","requires":["run_tests","read_files","parse_diff"]},{"criterion":"Existing tests pass after the migration, or obsolete daily-summary expectations are intentionally updated to the new live-update behavior.","priority":"must","requires":["run_tests"]},{"criterion":"The implementation avoids duplicating the full generate_summary() pipeline inside the new live editor; shared behavior is extracted or reused through focused helpers.","priority":"should","requires":["read_files","parse_diff","subjective_judgment"]},{"criterion":"The live editor has small, testable units for change detection, persistence, rendering/chunking, and Discord publishing.","priority":"should","requires":["read_files","parse_diff","subjective_judgment"]},{"criterion":"A staging/dev Discord smoke test confirms that the bot edits the expected summary message and logs a successful live revision.","priority":"info","requires":["inspect_runtime_ui","observe_runtime_logs"]}],"assumptions":["The settled product direction is an always-current live update edited in place, not a once-per-day generated digest posted at a fixed time.","The old batch summarizer may remain as a manually invoked legacy/backfill tool during rollout, but it should not be the default scheduled behavior.","The live editor can reuse the existing NewsSummarizer prompts and JSON summary format initially, with prompt changes limited to providing previous-summary context for incremental edits.","The existing archive/message storage pipeline remains the source of truth for Discord messages; this plan does not replace message ingestion.","Supabase schema changes are allowed if needed, but the plan preserves compatibility paths because the repository currently has direct daily_summaries assumptions and no obvious migration folder in the inspected tree."]}
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are revising an implementation plan after critique and gate feedback.
code
Project directory:
/Users/user_c042661f/Documents/banodoco-workspace/brain-of-bndc
Engineering brief produced from the codebase and task details:
### Task Summary
Prepared the engineering brief for replacing the scheduled daily summary system with an agentic live-update editor. The brief is written to `.megaplan/plans/implement-the-replacement-of-20260508-1449/prep.json` and validates as JSON.
### Key Evidence
- The current scheduled daily summary entrypoint is `SummarizerCog.run_daily_summary`, which calls `ChannelSummarizer.generate_summary()` at 07:00 UTC. (source: src/features/summarising/summariser_cog.py:18-32; relevance: high)
The main implementation is a broad batch pipeline in ChannelSummarizer.generate_summary(), so this is not a narrow file edit. (source: src/features/summarising/summariser.py:2219-2616; relevance: high)
Health/admin tooling currently assumes daily_summaries, so replacement needs compatibility or migration work. (source: src/features/health/health_check_cog.py:117-138; src/features/admin_chat/tools.py:2318-2365; relevance: high)
code
### Relevant Code
| File | Functions | Why |
| --- | --- | --- |
| .megaplan/plans/implement-the-replacement-of-20260508-1449/prep.json | - | New prep brief requested by the harness. |
code
### Test Expectations
- [pass_to_pass] json validation: `prep.json` parses successfully with `python -m json.tool`.
### Constraints
- Did not invoke megaplan CLI, activate megaplan skill, or recurse into another planning harness.
### Suggested Approach
Use the generated prep brief as the primary context for subsequent planning/execution.
The engineering brief above was produced by analyzing the codebase. Use it as a strong starting point, but the suggested approach is a hypothesis — verify it's the best fix, not just a valid one.
Idea:
Implement the replacement of the current daily summary system with an agentic live-update editor end to end. See the user intent and settled product decisions in this prompt.
User notes and answers:
Settled decisions override the planner questions: daily summaries are being replaced, not updated in place. Public live updates must be posted as sequential feed items in the configured summary channel reused as the live-updates channel, without per-channel summary threads or channel-local summaries. The system is an agentic scheduled editorial loop with watchlist/editorial-memory storage, auditable run/candidate/decision state, duplicate suppression, author-context investigation, multiple update types, and ongoing top-creations behavior decoupled from the old daily flow. The plan should treat prior daily_summaries storage as legacy/migration input rather than active live-flow storage.
code
Current plan (markdown):
# Implementation Plan: Agentic Live-Update Editor
Overview
Replace the 07:00 UTC daily batch summary with a live editor that incrementally maintains a current community update in Discord and persistence. The current path is centered on SummarizerCog.run_daily_summary() in src/features/summarising/summariser_cog.py, which calls the broad batch pipeline ChannelSummarizer.generate_summary() in src/features/summarising/summariser.py. Storage and admin/health tooling currently assume daily_summaries, through src/common/db_handler.py, src/common/storage_handler.py, src/features/health/health_check_cog.py, src/features/admin_chat/tools.py, and scripts/discord_tools.py.
The simplest durable approach is not to edit the monolithic batch function in place. Add a live-update service beside it, reuse the existing message retrieval, formatting, moderation, media persistence, and DB wrappers where possible, then switch scheduling/admin health to the new live-update contract while leaving manual batch commands available during rollout.
Extract the reusable parts of ChannelSummarizer.generate_summary() into narrower methods if needed: active-channel selection, channel history loading, summary generation/verification, media filtering, Discord formatting, media persistence, and short-summary generation.
Keep behavior changes out of the extraction step. The goal is to make live editing call existing logic without copying the 400-line batch pipeline.
Add focused tests around any extracted pure/helper behavior, especially JSON summary enrichment and formatting inputs.
Step 2: Choose and implement persistence compatibility (src/common/db_handler.py, src/common/storage_handler.py)
Scope: Medium
Add explicit live-summary persistence methods such as get_live_summary_state, upsert_live_summary_state, and record_live_summary_revision.
Prefer a new Supabase table/model for live state if schema migrations are available in the repo; otherwise add wrapper methods that can initially store compatible rows in daily_summaries with a clear discriminator in the existing fields.
Preserve reads for existing daily_summaries until admin tools and downstream scripts are migrated.
Document any required Supabase schema change in the same style as this repository uses for operational DB changes, since no migration directory was visible in the inspected tree.
Phase 2: Build the Live Editor
Step 3: Add the live-update service (src/features/summarising/live_update_editor.py)
Scope: Large
Create a LiveUpdateEditor class responsible for maintaining one current editable summary per guild/day or per configured summary channel.
Implement a cheap change detector that reads newly archived messages since the last processed timestamp and skips work when there is no meaningful new activity.
Generate incremental candidate updates through NewsSummarizer, using the previous live summary as context so the agent edits the existing update rather than regenerating the full day blindly.
Moderate and format output with existing filter_summary_media() and NewsSummarizer.format_news_for_discord() before publishing.
Persist every accepted revision with source message IDs, processed timestamp, summary message IDs, short summary, dev-mode flag, and guild ID.
Step 4: Publish by editing Discord messages (src/features/summarising/live_update_editor.py, src/common/discord_utils.py if needed)
Scope: Medium
Post the first live update to the configured summary channel when no editable message exists.
Edit existing bot-authored summary messages on subsequent updates instead of posting a new daily digest.
Handle Discord length limits by maintaining a stable ordered set of bot messages for the live update, adding/removing tail messages only when the formatted content crosses message boundaries.
Avoid forum-channel posting unless current support is confirmed; keep the existing batch behavior of skipping unsupported forum destinations.
Stop starting run_daily_summary as the default 07:00 UTC loop.
Start a live-update loop in SummarizerCog with a configurable interval, for example every 15 minutes, after bot readiness and archive startup conditions are satisfied.
Rename or repurpose commands carefully: keep summarynow as an owner/admin manual trigger, but make it run one live-editor pass by default.
Keep an explicit legacy/manual batch command or flag only if operators still need the old backfill/combine behavior during migration.
Update CLI flags in main.py: deprecate --combine-only and --clear-today-summaries for live mode, or make their behavior explicit and non-ambiguous.
Phase 3: Compatibility and Operations
Step 6: Update health checks (src/features/health/health_check_cog.py)
Scope: Small
Replace_check_daily_summary() with a live-summary freshness check after the configured live editor start time.
Verify the latest live summary state has been updated recently and has at least one Discord message ID or persisted revision.
Keep the alert actionable, e.g. no live update generated in the last N minutes despite recent message activity.
Add or rename admin tooling from get_daily_summaries to a live-summary-aware tool such as get_live_summaries.
Keep a compatibility wrapper for get_daily_summaries during rollout if external prompts or operators still call it.
Update the tool schema descriptions in src/features/admin_chat/tools.py and the admin agent tool list in src/features/admin_chat/agent.py so the agent no longer describes summaries as daily-only.
Updatescripts/discord_tools.py::summaries() to read the new live state or include both old daily rows and live revisions clearly.
Check social-picks behavior that currently reads today’s summary via get_summary_for_date().
Route social picks to the latest live summary state so the DM workflow still works after the batch main summary is removed.
Keep top generations, top art sharing, and speaker welcome behavior only if product intent still wants them in the live update; otherwise isolate them behind manual/admin commands rather than posting them every live pass.
Phase 4: Tests and Validation
Step 9: Add focused unit tests (tests/)
Scope: Medium
Add tests for live state persistence wrapper behavior with mocked Supabase clients.
Add tests for Discord edit chunking: first publish posts messages, later publish edits existing messages, overflow creates stable extra messages, shrink removes or blanks stale tail messages according to the chosen implementation.
Add tests for the live loop decision: no new source messages skips LLM calls and Discord edits.
Add tests for health/admin compatibility functions using mocked table responses.
Step 10: Run validation (pytest, targeted checks)
Scope: Small
Run cheap targeted tests first for the new live editor and persistence wrappers.
Run existing scheduler/admin/health-related tests to catch regressions.
Run the full test suite after wiring is complete.
Run import/compile checks if the full suite cannot cover Discord cog loading.
Execution Order
Extract narrow reusable helpers from the batch summarizer without changing behavior.
Add persistence wrappers and tests before wiring live runtime behavior.
Build LiveUpdateEditor with mocked Discord/LLM tests.
Switch SummarizerCog scheduling only after the editor can run one pass safely.
Update health/admin/scripts compatibility last, once the new persisted shape is settled.
Validation Order
python -m pytest tests/<new_live_editor_tests>.py for fast feedback.
Targeted existing tests around admin, scheduler, and scripts if present.
python -m pytest for the full suite.
Manual or staging Discord smoke test: start bot in dev mode, force one live pass, send a new archived message batch, confirm the same summary message is edited rather than a new daily summary being posted.
code
Current plan metadata:
{
"version": 1,
"timestamp": "2026-05-08T12:54:30Z",
"hash": "sha256:89c189fb9c00c134fc2a822ffefa8c17de11504824f97b64fcd282df6ddb3213",
"questions": [
"What is the intended trigger cadence for the live editor: on every archived message batch, a fixed interval, or a Discord event-driven pass on each new message?",
"Should the live update replace the public summary channel message in place, maintain a thread, or update per-channel summary threads as well?",
"Should top generations, top art sharing, new-speaker welcomes, and social-picks DM remain part of the live-update workflow, move to manual commands, or stay on a separate daily schedule?",
"Is a Supabase schema change acceptable for a dedicated live-summary state/revisions table, or must this remain compatible with the existing daily_summaries table only?"
],
"success_criteria": [
{
"criterion": "The default bot runtime no longer starts the 07:00 UTC run_daily_summary batch loop and instead starts the live-update editor loop or trigger path.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "A live editor pass can create an initial summary message and later update the same persisted Discord message IDs instead of posting a new daily summary for every pass.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "The live editor skips LLM and Discord edit work when there are no new relevant messages since the last processed checkpoint.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Summary persistence records enough state to resume after restart: guild ID, dev mode, summary channel, summary message IDs, latest full and short summary, source message/checkpoint metadata, and update timestamp.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Health checks no longer alert solely because today's daily_summaries row is missing; they check live-summary freshness under the new contract.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Admin summary tooling can retrieve current live summaries and does not describe the feature as daily-only in tool schemas/prompts.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Existing tests pass after the migration, or obsolete daily-summary expectations are intentionally updated to the new live-update behavior.",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "The implementation avoids duplicating the full generate_summary() pipeline inside the new live editor; shared behavior is extracted or reused through focused helpers.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "The live editor has small, testable units for change detection, persistence, rendering/chunking, and Discord publishing.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "A staging/dev Discord smoke test confirms that the bot edits the expected summary message and logs a successful live revision.",
"priority": "info",
"requires": [
"inspect_runtime_ui",
"observe_runtime_logs"
]
}
],
"assumptions": [
"The settled product direction is an always-current live update edited in place, not a once-per-day generated digest posted at a fixed time.",
"The old batch summarizer may remain as a manually invoked legacy/backfill tool during rollout, but it should not be the default scheduled behavior.",
"The live editor can reuse the existing prompts and JSON summary format initially, with prompt changes limited to providing previous-summary context for incremental edits.",
"The existing archive/message storage pipeline remains the source of truth for Discord messages; this plan does not replace message ingestion.",
"Supabase schema changes are allowed if needed, but the plan preserves compatibility paths because the repository currently has direct assumptions and no obvious migration folder in the inspected tree."
],
"structure_warnings": []
}
code
Gate summary:
{
"passed": false,
"criteria_check": {
"count": 10,
"items": [
{
"criterion": "The default bot runtime no longer starts the 07:00 UTC run_daily_summary batch loop and instead starts the live-update editor loop or trigger path.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "A live editor pass can create an initial summary message and later update the same persisted Discord message IDs instead of posting a new daily summary for every pass.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "The live editor skips LLM and Discord edit work when there are no new relevant messages since the last processed checkpoint.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Summary persistence records enough state to resume after restart: guild ID, dev mode, summary channel, summary message IDs, latest full and short summary, source message/checkpoint metadata, and update timestamp.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Health checks no longer alert solely because today's daily_summaries row is missing; they check live-summary freshness under the new contract.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Admin summary tooling can retrieve current live summaries and does not describe the feature as daily-only in tool schemas/prompts.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Existing tests pass after the migration, or obsolete daily-summary expectations are intentionally updated to the new live-update behavior.",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "The implementation avoids duplicating the full generate_summary() pipeline inside the new live editor; shared behavior is extracted or reused through focused helpers.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "The live editor has small, testable units for change detection, persistence, rendering/chunking, and Discord publishing.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "A staging/dev Discord smoke test confirms that the bot edits the expected summary message and logs a successful live revision.",
"priority": "info",
"requires": [
"inspect_runtime_ui",
"observe_runtime_logs"
]
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Public live updates: Plan uses in-place message editing, but the settled product requires sequential feed items in the configured summary channel.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "User notes require sequential feed items; plan Step 4 says to edit existing bot-authored summary messages and success criterion 2 requires updating the same persisted Discord message IDs.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-002",
"concern": "Editorial state: Plan does not specify watchlist/editorial-memory storage, auditable run/candidate/decision records, duplicate suppression, author-context investigation, or multiple update types.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "The plan only describes accepted revisions, source message IDs, and a cheap change detector; no schema, service steps, or tests cover candidates, decisions, duplicate keys, watchlist memory, or author context.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-003",
"concern": "Persistence migration: Plan treats schema migrations as possibly unavailable despite the repo documenting as canonical.",
"category": "maintainability",
"severity_hint": "likely-significant",
"evidence": "README.md lines 74-81 require idempotent migrations in , and that directory exists; the plan says no migration directory was visible and suggests documentation-only schema changes or wrappers.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-004",
"concern": "Scheduler/archive integration: Plan does not define ordering between the new live loop and the existing hourly archive/startup summary gating.",
"category": "correctness",
"severity_hint": "uncertain",
"evidence": "main.py lines 143-146 and 330-339 gate hourly archive startup on , while SummarizerCog currently handles plus ; the plan only says to start a configurable live loop after readiness and archive startup conditions.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-005",
"concern": "Top creations: Plan leaves ongoing top-generations/top-art behavior as a later check instead of defining the required decoupled live-update behavior.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "User notes require ongoing top-creations behavior decoupled from the old daily flow; current calls , , and after the main summary, while the plan only says to check whether to keep or isolate them.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Public live-update publishing: The user notes explicitly require public live updates as sequential feed items in the configured summary channel, but the plan's Step 4 says to edit existing bot-authored summary messages and the success criteria require updating the same persisted Discord message IDs. That contradicts the settled product direction and would produce an in-place current digest rather than an append-only live feed.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Public live-update publishing: The user notes explicitly require public live updates as sequential feed items in the configured summary channel, but the plan's Step 4 says to edit existing bot-authored summary messages and the success criteria require updating the same persisted Discord message IDs. That contradicts the settled product direction and would produce an in-place current digest rather than an append-only live feed.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Agentic editorial loop: The user notes call for watchlist/editorial-memory storage, auditable run/candidate/decision state, duplicate suppression, author-context investigation, and multiple update types. I checked the plan sections for those concepts; aside from generic persistence of accepted revisions and a cheap change detector, the plan does not specify tables, state transitions, prompts, or tests for those required editorial artifacts.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Agentic editorial loop: The user notes call for watchlist/editorial-memory storage, auditable run/candidate/decision state, duplicate suppression, author-context investigation, and multiple update types. I checked the plan sections for those concepts; aside from generic persistence of accepted revisions and a cheap change detector, the plan does not specify tables, state transitions, prompts, or tests for those required editorial artifacts.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Persistence shape: Existing writes one row keyed by with and only, and treats that row as a once-per-day singleton. The plan's fallback of storing compatible live rows in is technically mismatched for auditable multiple runs, candidates, decisions, duplicate keys, checkpoints, and sequential feed items unless it adds a real schema discriminator plus revision tables.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Persistence shape: Existing writes one row keyed by with and only, and treats that row as a once-per-day singleton. The plan's fallback of storing compatible live rows in is technically mismatched for auditable multiple runs, candidates, decisions, duplicate keys, checkpoints, and sequential feed items unless it adds a real schema discriminator plus revision tables.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Migration assumption: The plan says no migration directory was visible and suggests merely documenting schema changes, but README.md lines 74-81 identify as the canonical Supabase migration location and that directory exists. A plan that needs new live-editor state should require an idempotent migration there rather than treating schema as unavailable.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Migration assumption: The plan says no migration directory was visible and suggests merely documenting schema changes, but README.md lines 74-81 identify as the canonical Supabase migration location and that directory exists. A plan that needs new live-editor state should require an idempotent migration there rather than treating schema as unavailable.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "scope-1",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Downstream daily-summary coupling is broader than the plan's high-level compatibility step: starts the 07:00 loop and calls , has , , and startup gating, health checks query , admin tools expose , and reads only . The plan names most of these areas, but it does not explicitly resolve the startup/archive gating contract that currently controls when archived messages are available.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Downstream daily-summary coupling is broader than the plan's high-level compatibility step: starts the 07:00 loop and calls , has , , and startup gating, health checks query , admin tools expose , and reads only . The plan names most of these areas, but it does not explicitly resolve the startup/archive gating contract that currently controls when archived messages are available.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "scope-2",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Ongoing creations behavior is not only a tail of : creates a top-generations thread from 24-hour data and initiates a sharing DM from the daily flow. The user notes say ongoing top-creations behavior must be decoupled from the old daily flow, while the plan only says to check/preserve or isolate it later, which leaves a required product behavior underspecified.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Ongoing creations behavior is not only a tail of : creates a top-generations thread from 24-hour data and initiates a sharing DM from the daily flow. The user notes say ongoing top-creations behavior must be decoupled from the old daily flow, while the plan only says to check/preserve or isolate it later, which leaves a required product behavior underspecified.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: I searched for , , , , , and . The plan includes the main runtime, health, admin tools, and scripts, but it omits , , , and , all of which still document or operate on ; those may be acceptable legacy references, but the plan should classify them as legacy or update them to avoid operational drift.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "I searched for , , , , , and . The plan includes the main runtime, health, admin tools, and scripts, but it omits , , , and , all of which still document or operate on ; those may be acceptable legacy references, but the plan should classify them as legacy or update them to avoid operational drift.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Call-site check: is called from the scheduled , the startup path after optional archive, and the owner command. The plan says to make run one live-editor pass, but it does not specify how plus should behave after the default flow is replaced, even though that startup path currently sets so hourly archive can begin.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Call-site check: is called from the scheduled , the startup path after optional archive, and the owner command. The plan says to make run one live-editor pass, but it does not specify how plus should behave after the default flow is replaced, even though that startup path currently sets so hourly archive can begin.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Data-access caller check: existing synchronous wraps async , while message retrieval for summaries is split between over the last 24 hours and . A live editor checkpoint should probably be built around or a new query method rather than reusing unchanged, because hard-codes a 24-hour window and per-channel threshold semantics.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Data-access caller check: existing synchronous wraps async , while message retrieval for summaries is split between over the last 24 hours and . A live editor checkpoint should probably be built around or a new query method rather than reusing unchanged, because hard-codes a 24-hour window and per-channel threshold semantics.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "criteria_quality-1",
"concern": "Are the success criteria well-prioritized and verifiable?: The must criterion requiring a later pass to update the same persisted Discord message IDs is verifiable, but it is the opposite of the settled requirement for sequential feed items in the summary channel. The criterion should be replaced with a yes/no check that each accepted live update is appended as a feed item and persisted with its message ID.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "The must criterion requiring a later pass to update the same persisted Discord message IDs is verifiable, but it is the opposite of the settled requirement for sequential feed items in the summary channel. The criterion should be replaced with a yes/no check that each accepted live update is appended as a feed item and persisted with its message ID.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "criteria_quality-2",
"concern": "Are the success criteria well-prioritized and verifiable?: The criteria do not include must-level checks for watchlist/editorial memory, auditable run/candidate/decision state, duplicate suppression, author-context investigation, multiple update types, or top-creations decoupling. Those are explicit user requirements, so the current success criteria would allow an implementation to pass while omitting large parts of the requested replacement.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "The criteria do not include must-level checks for watchlist/editorial memory, auditable run/candidate/decision state, duplicate suppression, author-context investigation, multiple update types, or top-creations decoupling. Those are explicit user requirements, so the current success criteria would allow an implementation to pass while omitting large parts of the requested replacement.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
}
],
"recommendation": "ITERATE",
"rationale": "The plan should not proceed because multiple significant flags identify direct contradictions with settled product requirements, not minor execution gaps. The biggest blocker is that the plan centers on editing an existing live summary message, while the user explicitly settled on sequential feed items in the configured summary channel. It also leaves core required architecture unspecified: watchlist/editorial memory, run/candidate/decision audit state, duplicate suppression, author-context investigation, multiple update types, canonical Supabase migrations, archive scheduler ordering, and decoupled top-creations behavior. These are plan-quality issues that can be fixed by revising the plan; they do not require a human tiebreaker because the product direction is already stated.",
"signals_assessment": "Preflight is healthy: the project exists and is writable, and success criteria are present. The weighted score is poor at 23.0 with 16 unresolved significant flags and no resolved flags. Several concerns recur across fuzzy groups and iterations, but they point to the same concrete plan omissions and contradictions rather than an unresolvable architectural tension. The correct next move is to iterate the plan around the settled live-feed/editorial-loop contract before execution.",
"warnings": [
"Revise the success criteria before implementation; the current criterion requiring updates to the same Discord message ID is the opposite of the settled sequential-feed requirement.",
"Require a real Supabase migration in for live editor state instead of falling back to for active live-flow storage.",
"Define the runtime contract for startup archive, hourly archive, , , and live editor scheduling before touching scheduler code."
],
"settled_decisions": [
{
"id": "public_publishing_model",
"decision": "Accepted live updates are appended as sequential feed items in the configured summary channel reused as the live-updates channel.",
"rationale": "This is explicitly settled in the user notes and resolves the conflict with the rejected in-place editing model."
},
{
"id": "daily_summaries_role",
"decision": " is legacy/migration input only, not active live-flow storage.",
"rationale": "The replacement requires auditable live run/candidate/decision state and sequential feed item persistence that do not fit the current once-per-day daily summary row shape."
},
{
"id": "schema_strategy",
"decision": "Use canonical Supabase migrations under for new live editor tables/state.",
"rationale": "The critique evidence says the repo documents this location as canonical and the directory exists."
},
{
"id": "editorial_loop_scope",
"decision": "The implementation must include watchlist/editorial memory, auditable runs/candidates/decisions, duplicate suppression, author-context investigation, and multiple update types.",
"rationale": "These are explicit user requirements, not optional enhancements."
},
{
"id": "top_creations_scope",
"decision": "Ongoing top-creations behavior must be decoupled from the old daily flow.",
"rationale": "The user notes require this, and the current plan leaves it underspecified."
}
],
"override_forced": false,
"orchestrator_guidance": "First iteration; follow gate recommendation: ITERATE. Verify unresolved flags against the plan and project code before accepting.",
"robustness": "robust",
"signals": {
"iteration": 1,
"idea": "Implement the replacement of the current daily summary system with an agentic live-update editor end to end. See the user intent and settled product decisions in this prompt.",
"significant_flags": 16,
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Public live updates: Plan uses in-place message editing, but the settled product requires sequential feed items in the configured summary channel.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-002",
"concern": "Editorial state: Plan does not specify watchlist/editorial-memory storage, auditable run/candidate/decision records, duplicate suppression, author-context investigation, or multiple update types.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-003",
"concern": "Persistence migration: Plan treats schema migrations as possibly unavailable despite the repo documenting as canonical.",
"category": "maintainability",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-004",
"concern": "Scheduler/archive integration: Plan does not define ordering between the new live loop and the existing hourly archive/startup summary gating.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-005",
"concern": "Top creations: Plan leaves ongoing top-generations/top-art behavior as a later check instead of defining the required decoupled live-update behavior.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Public live-update publishing: The user notes explicitly require public live updates as sequential feed items in the configured summary channel, but the plan's Step 4 says to edit existing bot-authored summary messages and the success criteria require updating the same persisted Discord message IDs. That contradicts the settled product direction and would produce an in-place current digest rather than an append-only live feed.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Agentic editorial loop: The user notes call for watchlist/editorial-memory storage, auditable run/candidate/decision state, duplicate suppression, author-context investigation, and multiple update types. I checked the plan sections for those concepts; aside from generic persistence of accepted revisions and a cheap change detector, the plan does not specify tables, state transitions, prompts, or tests for those required editorial artifacts.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Persistence shape: Existing writes one row keyed by with and only, and treats that row as a once-per-day singleton. The plan's fallback of storing compatible live rows in is technically mismatched for auditable multiple runs, candidates, decisions, duplicate keys, checkpoints, and sequential feed items unless it adds a real schema discriminator plus revision tables.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Migration assumption: The plan says no migration directory was visible and suggests merely documenting schema changes, but README.md lines 74-81 identify as the canonical Supabase migration location and that directory exists. A plan that needs new live-editor state should require an idempotent migration there rather than treating schema as unavailable.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "scope-1",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Downstream daily-summary coupling is broader than the plan's high-level compatibility step: starts the 07:00 loop and calls , has , , and startup gating, health checks query , admin tools expose , and reads only . The plan names most of these areas, but it does not explicitly resolve the startup/archive gating contract that currently controls when archived messages are available.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "scope-2",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Ongoing creations behavior is not only a tail of : creates a top-generations thread from 24-hour data and initiates a sharing DM from the daily flow. The user notes say ongoing top-creations behavior must be decoupled from the old daily flow, while the plan only says to check/preserve or isolate it later, which leaves a required product behavior underspecified.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: I searched for , , , , , and . The plan includes the main runtime, health, admin tools, and scripts, but it omits , , , and , all of which still document or operate on ; those may be acceptable legacy references, but the plan should classify them as legacy or update them to avoid operational drift.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Call-site check: is called from the scheduled , the startup path after optional archive, and the owner command. The plan says to make run one live-editor pass, but it does not specify how plus should behave after the default flow is replaced, even though that startup path currently sets so hourly archive can begin.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Data-access caller check: existing synchronous wraps async , while message retrieval for summaries is split between over the last 24 hours and . A live editor checkpoint should probably be built around or a new query method rather than reusing unchanged, because hard-codes a 24-hour window and per-channel threshold semantics.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "criteria_quality-1",
"concern": "Are the success criteria well-prioritized and verifiable?: The must criterion requiring a later pass to update the same persisted Discord message IDs is verifiable, but it is the opposite of the settled requirement for sequential feed items in the summary channel. The criterion should be replaced with a yes/no check that each accepted live update is appended as a feed item and persisted with its message ID.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "criteria_quality-2",
"concern": "Are the success criteria well-prioritized and verifiable?: The criteria do not include must-level checks for watchlist/editorial memory, auditable run/candidate/decision state, duplicate suppression, author-context investigation, multiple update types, or top-creations decoupling. Those are explicit user requirements, so the current success criteria would allow an implementation to pass while omitting large parts of the requested replacement.",
"category": "completeness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [],
"weighted_score": 23.0,
"weighted_history": [],
"plan_delta_from_previous": null,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 1. Weighted score trajectory: 23.0. Plan deltas: n/a. Recurring critiques: 0. Resolved flags: 0. Open significant flags: 16.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"flag_resolutions": [],
"resolved_flag_ids": [],
"resolution_summary": "",
"reprompted": false
}
code
Open significant flags:
[
{
"id": "FLAG-001",
"severity": "significant",
"status": "open",
"concern": "Public live updates: Plan uses in-place message editing, but the settled product requires sequential feed items in the configured summary channel.",
"evidence": "User notes require sequential feed items; plan Step 4 says to edit existing bot-authored summary messages and success criterion 2 requires updating the same persisted Discord message IDs."
},
{
"id": "FLAG-002",
"severity": "significant",
"status": "open",
"concern": "Editorial state: Plan does not specify watchlist/editorial-memory storage, auditable run/candidate/decision records, duplicate suppression, author-context investigation, or multiple update types.",
"evidence": "The plan only describes accepted revisions, source message IDs, and a cheap change detector; no schema, service steps, or tests cover candidates, decisions, duplicate keys, watchlist memory, or author context."
},
{
"id": "FLAG-003",
"severity": "significant",
"status": "open",
"concern": "Persistence migration: Plan treats schema migrations as possibly unavailable despite the repo documenting ../supabase/migrations/ as canonical.",
"evidence": "README.md lines 74-81 require idempotent migrations in ../supabase/migrations/, and that directory exists; the plan says no migration directory was visible and suggests documentation-only schema changes or daily_summaries wrappers."
},
{
"id": "FLAG-004",
"severity": "significant",
"status": "open",
"concern": "Scheduler/archive integration: Plan does not define ordering between the new live loop and the existing hourly archive/startup summary gating.",
"evidence": "main.py lines 143-146 and 330-339 gate hourly archive startup on summary_completed, while SummarizerCog currently handles --summary-now plus --archive-days; the plan only says to start a configurable live loop after readiness and archive startup conditions."
},
{
"id": "FLAG-005",
"severity": "significant",
"status": "open",
"concern": "Top creations: Plan leaves ongoing top-generations/top-art behavior as a later check instead of defining the required decoupled live-update behavior.",
"evidence": "User notes require ongoing top-creations behavior decoupled from the old daily flow; current generate_summary() calls post_top_x_generations, post_top_art_share, and _post_new_speakers after the main summary, while the plan only says to check whether to keep or isolate them."
},
{
"id": "issue_hints-1",
"severity": "significant",
"status": "open",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Public live-update publishing: The user notes explicitly require public live updates as sequential feed items in the configured summary channel, but the plan's Step 4 says to edit existing bot-authored summary messages and the success criteria require updating the same persisted Discord message IDs. That contradicts the settled product direction and would produce an in-place current digest rather than an append-only live feed.",
"evidence": "Public live-update publishing: The user notes explicitly require public live updates as sequential feed items in the configured summary channel, but the plan's Step 4 says to edit existing bot-authored summary messages and the success criteria require updating the same persisted Discord message IDs. That contradicts the settled product direction and would produce an in-place current digest rather than an append-only live feed."
},
{
"id": "issue_hints-2",
"severity": "significant",
"status": "open",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Agentic editorial loop: The user notes call for watchlist/editorial-memory storage, auditable run/candidate/decision state, duplicate suppression, author-context investigation, and multiple update types. I checked the plan sections for those concepts; aside from generic persistence of accepted revisions and a cheap change detector, the plan does not specify tables, state transitions, prompts, or tests for those required editorial artifacts.",
"evidence": "Agentic editorial loop: The user notes call for watchlist/editorial-memory storage, auditable run/candidate/decision state, duplicate suppression, author-context investigation, and multiple update types. I checked the plan sections for those concepts; aside from generic persistence of accepted revisions and a cheap change detector, the plan does not specify tables, state transitions, prompts, or tests for those required editorial artifacts."
},
{
"id": "correctness-1",
"severity": "significant",
"status": "open",
"concern": "Are the proposed changes technically correct?: Persistence shape: Existing writes one row keyed by with and only, and treats that row as a once-per-day singleton. The plan's fallback of storing compatible live rows in is technically mismatched for auditable multiple runs, candidates, decisions, duplicate keys, checkpoints, and sequential feed items unless it adds a real schema discriminator plus revision tables.",
"evidence": "Persistence shape: Existing writes one row keyed by with and only, and treats that row as a once-per-day singleton. The plan's fallback of storing compatible live rows in is technically mismatched for auditable multiple runs, candidates, decisions, duplicate keys, checkpoints, and sequential feed items unless it adds a real schema discriminator plus revision tables."
},
{
"id": "correctness-2",
"severity": "significant",
"status": "open",
"concern": "Are the proposed changes technically correct?: Migration assumption: The plan says no migration directory was visible and suggests merely documenting schema changes, but README.md lines 74-81 identify as the canonical Supabase migration location and that directory exists. A plan that needs new live-editor state should require an idempotent migration there rather than treating schema as unavailable.",
"evidence": "Migration assumption: The plan says no migration directory was visible and suggests merely documenting schema changes, but README.md lines 74-81 identify as the canonical Supabase migration location and that directory exists. A plan that needs new live-editor state should require an idempotent migration there rather than treating schema as unavailable."
},
{
"id": "scope-1",
"severity": "significant",
"status": "open",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Downstream daily-summary coupling is broader than the plan's high-level compatibility step: starts the 07:00 loop and calls , has , , and startup gating, health checks query , admin tools expose , and reads only . The plan names most of these areas, but it does not explicitly resolve the startup/archive gating contract that currently controls when archived messages are available.",
"evidence": "Downstream daily-summary coupling is broader than the plan's high-level compatibility step: starts the 07:00 loop and calls , has , , and startup gating, health checks query , admin tools expose , and reads only . The plan names most of these areas, but it does not explicitly resolve the startup/archive gating contract that currently controls when archived messages are available."
},
{
"id": "scope-2",
"severity": "significant",
"status": "open",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Ongoing creations behavior is not only a tail of : creates a top-generations thread from 24-hour data and initiates a sharing DM from the daily flow. The user notes say ongoing top-creations behavior must be decoupled from the old daily flow, while the plan only says to check/preserve or isolate it later, which leaves a required product behavior underspecified.",
"evidence": "Ongoing creations behavior is not only a tail of : creates a top-generations thread from 24-hour data and initiates a sharing DM from the daily flow. The user notes say ongoing top-creations behavior must be decoupled from the old daily flow, while the plan only says to check/preserve or isolate it later, which leaves a required product behavior underspecified."
},
{
"id": "all_locations",
"severity": "significant",
"status": "open",
"concern": "Does the change touch all locations AND supporting infrastructure?: I searched for , , , , , and . The plan includes the main runtime, health, admin tools, and scripts, but it omits , , , and , all of which still document or operate on ; those may be acceptable legacy references, but the plan should classify them as legacy or update them to avoid operational drift.",
"evidence": "I searched for , , , , , and . The plan includes the main runtime, health, admin tools, and scripts, but it omits , , , and , all of which still document or operate on ; those may be acceptable legacy references, but the plan should classify them as legacy or update them to avoid operational drift."
},
{
"id": "callers-1",
"severity": "significant",
"status": "open",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Call-site check: is called from the scheduled , the startup path after optional archive, and the owner command. The plan says to make run one live-editor pass, but it does not specify how plus should behave after the default flow is replaced, even though that startup path currently sets so hourly archive can begin.",
"evidence": "Call-site check: is called from the scheduled , the startup path after optional archive, and the owner command. The plan says to make run one live-editor pass, but it does not specify how plus should behave after the default flow is replaced, even though that startup path currently sets so hourly archive can begin."
},
{
"id": "callers-2",
"severity": "significant",
"status": "open",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Data-access caller check: existing synchronous wraps async , while message retrieval for summaries is split between over the last 24 hours and . A live editor checkpoint should probably be built around or a new query method rather than reusing unchanged, because hard-codes a 24-hour window and per-channel threshold semantics.",
"evidence": "Data-access caller check: existing synchronous wraps async , while message retrieval for summaries is split between over the last 24 hours and . A live editor checkpoint should probably be built around or a new query method rather than reusing unchanged, because hard-codes a 24-hour window and per-channel threshold semantics."
},
{
"id": "criteria_quality-1",
"severity": "significant",
"status": "open",
"concern": "Are the success criteria well-prioritized and verifiable?: The must criterion requiring a later pass to update the same persisted Discord message IDs is verifiable, but it is the opposite of the settled requirement for sequential feed items in the summary channel. The criterion should be replaced with a yes/no check that each accepted live update is appended as a feed item and persisted with its message ID.",
"evidence": "The must criterion requiring a later pass to update the same persisted Discord message IDs is verifiable, but it is the opposite of the settled requirement for sequential feed items in the summary channel. The criterion should be replaced with a yes/no check that each accepted live update is appended as a feed item and persisted with its message ID."
},
{
"id": "criteria_quality-2",
"severity": "significant",
"status": "open",
"concern": "Are the success criteria well-prioritized and verifiable?: The criteria do not include must-level checks for watchlist/editorial memory, auditable run/candidate/decision state, duplicate suppression, author-context investigation, multiple update types, or top-creations decoupling. Those are explicit user requirements, so the current success criteria would allow an implementation to pass while omitting large parts of the requested replacement.",
"evidence": "The criteria do not include must-level checks for watchlist/editorial memory, auditable run/candidate/decision state, duplicate suppression, author-context investigation, multiple update types, or top-creations decoupling. Those are explicit user requirements, so the current success criteria would allow an implementation to pass while omitting large parts of the requested replacement."
}
]
code
Requirements:
- Before addressing individual flags, check: does any flag suggest the plan is targeting the wrong code or the wrong root cause? If so, consider whether the plan needs a new approach rather than adjustments. Explain your reasoning.
- Update the plan to address the significant issues.
- Keep the plan readable and executable.
- Return flags_addressed with the exact flag IDs you addressed.
- Include `changes_summary` as a short plain-English summary of what changed in the revision. If there were no concrete flags, say that explicitly (for example: `No critique flags were raised; refined wording and kept the plan aligned for execution.`).
- Preserve or improve success criteria quality. Each criterion must have a `priority` of `must`, `should`, or `info`. Promote or demote priorities if critique feedback reveals a criterion was over- or under-weighted.
- Each success criterion should include a `requires` field listing the capabilities needed for verification. Valid capability strings: `run_shell`, `read_files`, `run_tests`, `parse_diff`, `read_build_output`, `run_linter` (container), `drive_browser`, `inspect_runtime_ui`, `observe_runtime_logs`, `subjective_judgment`, `verify_physical_device` (human). `must` criteria MUST have non-empty `requires`. Example: `{"criterion": "All tests pass", "priority": "must", "requires": ["run_tests"]}`.
- Verify that the plan remains aligned with the user's original intent, not just internal plan quality.
- Remove unjustified scope growth. If critique raised scope creep, narrow the plan back to the original idea unless the broader work is strictly required.
- Maintain the structural template: H1 title, ## Overview, phase sections with numbered step sections, ## Execution Order or ## Validation Order.
- CRITICAL: Your entire revised plan markdown (all sections) must be output as the `plan` field in the structured output. The prose response must not contain the plan text.
- CRITICAL: Return only the structured JSON object for the schema fields `plan`, `changes_summary`, `flags_addressed`, `assumptions`, `success_criteria`, and `questions`. Do not add commentary before or after the JSON object.
Plan template — simple format (adapt to the actual repo and scope):
md
# Implementation Plan: [Title]
## Overview
Summarize the goal, current repository shape, and the constraints that matter.
## Main Phase
### Step 1: Audit the current behavior (`megaplan/prompts.py`)
**Scope:** Small
1. **Inspect** the current implementation and call out the exact insertion points (`megaplan/prompts.py:29`).
### Step 2: Add the first change (`megaplan/evaluation.py`)
**Scope:** Medium
1. **Implement** the smallest viable change with exact file references (`megaplan/evaluation.py:1`).
2. **Capture** any tricky behavior with a short example.
```python
issues = validate_plan_structure(plan_text)
```
### Step 3: Wire downstream behavior (`megaplan/handlers.py`, `megaplan/workers.py`)
**Scope:** Medium
1. **Update** the runtime flow in the touched files (`megaplan/handlers.py:400`, `megaplan/workers.py:199`).
### Step 4: Prove the change (`tests/test_evaluation.py`, `tests/test_megaplan.py`)
**Scope:** Small
1. **Run** the cheapest targeted checks first (`tests/test_evaluation.py:1`).
2. **Finish** with broader verification once the wiring is in place (`tests/test_megaplan.py:1`).
## Execution Order
1. Update prompts and mocks before enforcing stricter validation.
2. Land higher-risk wiring after the validator and tests are ready.
## Validation Order
1. Start with focused unit tests.
2. Run the broader suite after the flow changes are in place.
For complex plans, use multiple phases:
md
## Phase 1: Foundation — Dependencies, DB, Types
### Step 1: Install dependencies (`package.json`)
...
### Step 2: Create database migration (`supabase/migrations/`)
...
## Phase 2: Core Integration
### Step 3: Port the main component (`src/components/`)
...
Template guidance:
Simple plans: use ## Main Phase with ### Step N: sections underneath.
Complex plans: use multiple ## Phase N: sections, each containing ### Step N: steps. Step numbers are global (not per-phase).
The flat ## Step N: format (without phases) also works for backwards compatibility.
Key invariants: one H1 title, one ## Overview, numbered step sections (### Step N: or ## Step N:), and at least one ordering section.
{
"plan": "# Implementation Plan: Agentic Sequential Live-Update Editor\n\n## Overview\nThe critique shows the prior plan targeted the wrong product shape: it treated the replacement as an in-place editable digest, while the settled requirement is an agentic scheduled editorial loop that appends public live-update feed items to the configured summary channel. The root cause is broader than SummarizerCog.run_daily_summary() itself: the current system combines scheduling, 24-hour batch summarization, Discord posting, daily-summary persistence, health checks, admin tools, and top-creations posting into one daily flow.\n\nThis revision replaces the daily batch flow with a new live editorial pipeline: scheduled runs inspect newly archived messages, investigate author/context signals, generate auditable candidates, suppress duplicates, record decisions, update watchlist/editorial memory, and append accepted updates as sequential feed items. daily_summaries becomes legacy/migration input only. Active live-flow state must use new Supabase tables added through the canonical ../supabase/migrations/ path.\n\n## Phase 1: Foundation — Schema, Contracts, and Legacy Boundaries\n\n### Step 1: Confirm runtime touch points and legacy boundaries (src/features/summarising/summariser_cog.py, main.py, src/features/summarising/summariser.py)\nScope: Small\n1. Confirm all current daily-summary callers: scheduled run_daily_summary, startup --summary-now plus optional --archive-days, owner summarynow, and any direct generate_summary() paths.\n2. ClassifyChannelSummarizer.generate_summary() as legacy batch behavior. Keep it callable only for explicit legacy/backfill use during migration, not for the default live-update flow.\n3. Identify helper methods worth reusing without carrying daily semantics: channel config lookup, Discord channel lookup/retry, media moderation, media persistence, and safe Discord send behavior.\n\n### Step 2: Add canonical live-editor migrations (../supabase/migrations/)\nScope: Large\n1. Create an idempotent Supabase migration for live-editor tables instead of storing active state in daily_summaries.\n2. Add tables for auditable state:\n - live_update_runs: run ID, guild ID, summary/live channel ID, trigger type, status, started/finished timestamps, checkpoint range, model metadata, error details.\n - live_update_candidates: candidate ID, run ID, update type, title/body/media/source message IDs, author-context snapshot, duplicate key, score/priority, raw agent output.\n - live_update_decisions: decision ID, candidate ID, decision status, reason, duplicate match, human/agent actor metadata.\n - live_update_feed_items: accepted candidate ID, Discord channel ID, Discord message ID, posted content, posted timestamp, dev mode.\n - live_editor_memory: durable editorial notes, watchlist items, topic state, author/project context, suppression windows, last-seen checkpoints.\n3. Add indexes and uniqueness constraints for duplicate suppression, especially (guild_id, duplicate_key) or a bounded active duplicate key table/window.\n4. Treatdaily_summaries as read-only legacy input for migration/admin history, not as active live-flow storage.\n\n### Step 3: Add storage and DB wrappers (src/common/storage_handler.py, src/common/db_handler.py)\nScope: Medium\n1. Implement typed wrapper methods for creating runs, inserting candidates, recording decisions, posting feed-item records, reading/updating editorial memory, and querying duplicate keys.\n2. Add a checkpoint query built around persisted messages after a stored timestamp/message ID, using or extending DatabaseHandler.get_messages_after(...) rather than reusing get_channel_history() with its 24-hour and per-channel threshold assumptions.\n3. Keep existing store_daily_summary, get_summary_for_date, and summary_exists_for_date intact for legacy tooling until migration is complete.\n\n## Phase 2: Agentic Editorial Pipeline\n\n### Step 4: Add the live editor service (src/features/summarising/live_update_editor.py)\nScope: Large\n1. CreateLiveUpdateEditor with one public entrypoint such as run_once(trigger: str).\n2. Load the current checkpoint, watchlist, editorial memory, recent accepted feed items, and duplicate suppression state at the start of each run.\n3. Fetch newly archived messages by guild/checkpoint, including thread/forum context where available.\n4. Record every run in live_update_runs, including skipped runs when there is no new material.\n\n### Step 5: Implement author-context investigation (src/features/summarising/live_update_editor.py, src/common/db_handler.py)\nScope: Medium\n1. Resolve author context for candidate-worthy messages from existing member/profile tables and recent message history.\n2. Attach context snapshots to candidates so decisions are auditable without relying on future mutable profile data.\n3. Capture project/topic continuity from live_editor_memory and recent accepted feed items before prompting the agent.\n\n### Step 6: Generate candidates and decisions (src/features/summarising/live_update_editor.py, src/features/summarising/subfeatures/news_summary.py or new prompt module)\nScope: Large\n1. Add agent prompts/helpers for multiple update types, such as news item, project progress, release/resource, question needing attention, correction/follow-up, and creation spotlight.\n2. Produce structured candidate JSON with source message IDs, update type, proposed public text, media references, duplicate key, confidence/priority, and rationale.\n3. Persist all candidates before filtering so rejected and duplicate outcomes remain auditable.\n4. Run decision logic that accepts, rejects, defers, or marks duplicate candidates, with an explicit decision reason for each.\n5. Update watchlist/editorial memory after decisions, including topics to revisit, topics to suppress, and author/project notes.\n\n### Step 7: Suppress duplicates (src/features/summarising/live_update_editor.py, src/common/storage_handler.py)\nScope: Medium\n1. Compute stable duplicate keys from source IDs, normalized topic/project identifiers, URLs, and update type.\n2. Check duplicate keys against recent candidates, decisions, feed items, and editorial memory before posting.\n3. Persist duplicate decisions with a pointer to the matched prior candidate/feed item.\n4. Test that repeated scheduled runs over the same source messages do not post another feed item.\n\n## Phase 3: Public Feed Publishing and Top Creations\n\n### Step 8: Publish accepted updates as sequential feed items (src/features/summarising/live_update_editor.py, src/common/discord_utils.py if needed)\nScope: Medium\n1. Post each accepted live update as a new message in the configured summary channel, reused as the live-updates channel.\n2. Do not edit an existing summary message, create per-channel summary threads, or post channel-local summaries for the live flow.\n3. Split overlong public content into sequential messages only when needed, while preserving a single feed-item record that stores all posted message IDs.\n4. Persist successful Discord message IDs in live_update_feed_items and mark failed posts in the candidate decision/run audit trail.\n\n### Step 9: Decouple top-creations behavior (src/features/summarising/subfeatures/top_generations.py, src/features/summarising/subfeatures/top_art_sharing.py, new scheduler/service as needed)\nScope: Medium\n1. Remove top-generation/top-art posting from the old daily summary tail as part of the default flow replacement.\n2. Create a separate scheduled service or cog method for ongoing top creations with its own cadence, checkpoint, duplicate suppression, and audit records.\n3. ReuseTopGenerations and TopArtSharing logic where possible, but do not require a daily summary run or daily summary thread to trigger them.\n4. Post top-creation items to the agreed configured destination as ongoing feed behavior, with persisted message IDs and suppression of repeat posts.\n\n## Phase 4: Runtime Wiring and Scheduling\n\n### Step 10: Replace daily scheduling with the editorial loop (src/features/summarising/summariser_cog.py)\nScope: Medium\n1. Stop starting the 07:00 UTC run_daily_summary loop by default.\n2. InstantiateLiveUpdateEditor in setup(...) alongside any legacy summarizer dependencies still needed for helper reuse.\n3. Start a configurable scheduled editorial loop after bot readiness and after startup archive handling has completed.\n4. Make owner summarynow run one live-editor pass and report whether it posted, skipped, or failed.\n5. Keep a clearly named legacy owner command only if operators still need a manual batch summary during transition.\n\n### Step 11: Resolve archive/startup gating (main.py, src/common/base_bot.py, src/features/summarising/summariser_cog.py)\nScope: Medium\n1. Definesummary_completed replacement semantics or rename usage so hourly archive startup is no longer blocked on a removed daily summary.\n2. For--summary-now, run one live-editor pass after optional --archive-days or --summary-with-archive completes, then release the startup gate.\n3. When no startup summary/live pass is requested, release the archive-start gate after bot readiness so the hourly archive can populate messages for later live-editor runs.\n4. Ensure live-editor scheduled runs read from archived/persisted messages and do not race ahead of the initial archive path.\n5. Deprecate or isolate --combine-only and --clear-today-summaries as legacy daily-summary controls, not live-editor controls.\n\n## Phase 5: Admin, Health, Scripts, and Docs\n\n### Step 12: Update health checks (src/features/health/health_check_cog.py)\nScope: Small\n1. Replace missing daily_summaries alerts with live-editor freshness checks based on live_update_runs and live_update_feed_items.\n2. Alert when recent archived activity exists but no successful run or no accepted/explicitly skipped decision has occurred within the configured freshness window.\n3. Include the latest failed run error in admin alerts when available.\n\n### Step 13: Update admin tools and agent descriptions (src/features/admin_chat/tools.py, src/features/admin_chat/agent.py, scripts/discord_tools.py)\nScope: Medium\n1. Add live-editor admin tools for latest runs, candidates, decisions, feed items, memory/watchlist, and duplicate decisions.\n2. Rename or supersede get_daily_summaries with live-update-aware tooling, while leaving legacy history access clearly labeled.\n3. Update tool schemas and admin agent descriptions so they do not present daily summaries as the active overview system.\n4. Updatescripts/discord_tools.py::summaries() or add a new script helper that reads live feed items and decisions.\n\n### Step 14: Classify operational legacy references (structure.md, docs/debug-utility-validation.md, scripts/debug.py, scripts/backfill_guild_ids.py)\nScope: Small\n1. Update architecture docs to describe live-editor tables as active and daily_summaries as legacy history/migration input.\n2. Update debug table labels and backfill scripts only where necessary for new live-editor tables and guild scoping.\n3. Avoid broad docs churn beyond locations that would mislead operators during debugging or migration.\n\n## Phase 6: Tests and Validation\n\n### Step 15: Add focused tests (tests/)\nScope: Large\n1. Test storage wrappers with mocked Supabase clients: runs, candidates, decisions, feed items, memory, duplicate keys, and checkpoints.\n2. Test candidate lifecycle: no new messages records a skipped run; new messages create candidates; duplicate candidates are rejected with match pointers; accepted candidates become feed items.\n3. Test public publishing: accepted updates call send, not edit, in the summary/live channel and persist the returned message IDs.\n4. Test author-context investigation with mocked member/profile/recent-message data.\n5. Test multiple update types are accepted by validation and persisted with explicit type fields.\n6. Test scheduler/startup behavior for --summary-now, --archive-days, no startup summary, and owner summarynow.\n7. Test health/admin functions against live-editor tables and legacy daily-summary history.\n8. Test top-creations scheduling is independent of generate_summary().\n\n### Step 16: Run validation (pytest, compile/import checks)\nScope: Small\n1. Run targeted tests for live editor, storage wrappers, scheduler wiring, health/admin tools, and top creations first.\n2. Run import/compile checks for changed modules to catch cog-loading errors.\n3. Run the full test suite.\n4. Perform a dev/staging Discord smoke test: run one live pass with archived messages, verify sequential feed messages are posted in the configured summary channel, verify duplicate rerun skips posting, and inspect live run/candidate/decision records.\n\n## Execution Order\n1. Land the migration and DB/storage wrappers first; do not wire runtime code until active live-flow state exists outside daily_summaries.\n2. Build and test the editorial pipeline without Discord posting by persisting runs, candidates, decisions, memory, and duplicate outcomes.\n3. Add sequential feed publishing once accepted decisions are auditable.\n4. Wire SummarizerCog, startup/archive gating, and CLI/manual command behavior after the live editor can run one pass safely.\n5. Decouple top creations from the daily flow and add its independent scheduler/checkpoint.\n6. Update health/admin/scripts/docs after the new tables and runtime contracts are stable.\n\n## Validation Order\n1. Run migration/static validation and targeted storage tests.\n2. Run live-editor unit tests for candidate lifecycle, duplicate suppression, author context, and update types.\n3. Run scheduler/startup tests before removing default daily scheduling.\n4. Run health/admin/top-creations tests.\n5. Run the full suite and complete the dev/staging Discord smoke test.",
"changes_summary": "Reworked the plan around the settled sequential-feed editorial-loop product instead of the rejected in-place digest model. The revision requires canonical Supabase migrations, auditable run/candidate/decision/memory state, duplicate suppression, author-context investigation, multiple update types, explicit archive/startup scheduling behavior, and decoupled top-creations handling.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"FLAG-003",
"FLAG-004",
"FLAG-005",
"issue_hints-1",
"issue_hints-2",
"correctness-1",
"correctness-2",
"scope-1",
"scope-2",
"all_locations",
"callers-1",
"callers-2",
"criteria_quality-1",
"criteria_quality-2"
],
"assumptions": [
"The configured summary channel is reused as the public live-updates channel.",
"Accepted live updates are appended as sequential feed items; the active live flow does not edit a standing digest message, create per-channel summary threads, or post channel-local summaries.",
"daily_summaries remains available only for legacy history, migration, or explicit legacy/backfill commands.",
"New active live-editor state will be added through idempotent Supabase migrations under ../supabase/migrations/.",
"The live editor consumes archived/persisted Discord messages, so startup and scheduled runs must respect archive/checkpoint ordering.",
"Top creations remain a product requirement, but they must run through an independent ongoing scheduler/checkpoint rather than the removed daily summary tail."
],
"success_criteria": [
{
"criterion": "The default bot runtime no longer starts the 07:00 UTC run_daily_summary batch loop, and default scheduled summary work goes through the live editorial loop.",
"priority": "must",
"requires": [
"read_files",
"parse_diff",
"run_tests"
]
},
{
"criterion": "Accepted live updates are posted as new sequential feed items in the configured summary/live-updates channel, and tests verify posting uses send behavior rather than editing an existing digest message.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Active live-flow storage uses new migrated live-editor tables for runs, candidates, decisions, feed items, memory/watchlist, and duplicate state; daily_summaries is not used for active live-flow writes.",
"priority": "must",
"requires": [
"read_files",
"parse_diff",
"run_tests"
]
},
{
"criterion": "A canonical idempotent Supabase migration exists under ../supabase/migrations/ for the live-editor persistence model.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "Every live-editor run records auditable run, candidate, and decision state, including skipped and duplicate outcomes.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Duplicate suppression prevents reposting the same accepted update across repeated scheduled runs over the same source messages and records the duplicate match/reason.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Author-context investigation is part of candidate generation and persisted as an auditable candidate snapshot.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "The live editor supports and persists multiple update types with explicit type fields and tests covering more than one type.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Watchlist/editorial memory is read before candidate generation and updated after decisions, with tests for memory persistence.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "--summary-now, --archive-days, no-startup-summary behavior, owner summarynow, and hourly archive startup gating have explicit tested behavior after daily-summary replacement.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Ongoing top-creations behavior is decoupled from ChannelSummarizer.generate_summary() and has its own scheduler/checkpoint or equivalent trigger with duplicate suppression.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Health checks and admin tools read live-editor state for active overview behavior and label daily_summaries as legacy history where still exposed.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Existing tests pass after the migration, with obsolete daily-summary expectations intentionally updated to the new live-update behavior.",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "Operational references in docs/debug/backfill surfaces are either updated for live-editor tables or clearly classified as legacy daily-summary tooling.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "The implementation keeps the monolithic daily batch pipeline isolated as legacy/backfill code and avoids copying it wholesale into the live editor.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "A dev/staging Discord smoke test confirms a live pass appends feed items, a duplicate rerun does not post again, and run/candidate/decision records are inspectable.",
"priority": "info",
"requires": [
"inspect_runtime_ui",
"observe_runtime_logs"
]
}
],
"questions": []
}