feat: add opt-in LCM task suggestion tools (6/10)#539
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a disabled-by-default “task bridge” suggestion tool layer on top of the LCM observed-work and suggestion-ledger storage, plus the supporting temporal rollup/recall surfaces and documentation/config wiring needed to safely preview/record/review suggestions without external task mutation.
Changes:
- Introduces observed-work density storage +
lcm_work_density, and temporal rollups +lcm_recent(+ optionallcm_rollup_debug). - Adds opt-in
lcm_task_suggestions(preview/record) andlcm_task_suggestion_review(review-state updates) gated bytaskBridgeToolsEnabled/LCM_TASK_BRIDGE_TOOLS_ENABLED. - Wires migrations, engine accessors, plugin tool registration, tests, and skill/docs updates.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/task-bridge-suggestion-store.test.ts | Adds coverage for suggestion ledger + tool preview/record/review behavior and “no external task writes” contract. |
| test/plugin-prompt-hook.test.ts | Updates prompt-hook expectations for revised recall-tool routing guidance. |
| test/observed-work-store.test.ts | Adds tests for observed-work storage, source redaction, state tracking, and lcm_work_density behavior. |
| src/tools/lcm-work-density-tool.ts | New lcm_work_density tool with period bounds, filtering, and source redaction. |
| src/tools/lcm-task-suggestions-tool.ts | New opt-in suggestion preview/record tool + review tool wrapper. |
| src/tools/lcm-rollup-debug-tool.ts | New operator-facing rollup inspection tool (config-gated). |
| src/tools/lcm-recent-tool.ts | New lcm_recent temporal recall tool with rollup-first + bounded SQL fallback retrieval. |
| src/timezone-windows.ts | Adds/extends timezone helpers used for deterministic day/window resolution. |
| src/store/task-bridge-suggestion-store.ts | Implements inert suggestion ledger storage + review-state updates. |
| src/store/rollup-store.ts | Implements rollup persistence/state/source APIs used by builder + tools. |
| src/store/observed-work-store.ts | Implements observed-work items/sources/state and density query. |
| src/rollup-builder.ts | Implements daily + weekly/monthly rollup building and provenance tracking. |
| src/plugin/index.ts | Registers new tools and gates opt-in ones via config flags. |
| src/engine.ts | Adds rollup/observed-work/suggestion stores + rollup maintenance integration and engine accessors. |
| src/db/migration.ts | Adds migrations for rollups, observed-work tables, and suggestion ledger (+ indexes/views). |
| src/db/config.ts | Adds rollupDebugEnabled and taskBridgeToolsEnabled config + env var wiring. |
| specs/lcm-temporal-memory-plan.md | Documents the temporal-memory stack plan and rollout map. |
| specs/lcm-task-bridge-option-c-experimental.md | Documents Option C task-bridge goals/guardrails and ledger schema/tool surface. |
| specs/lcm-observed-work-density-option-b.md | Documents Option B observed-work density model and tool contract. |
| skills/lossless-claw/references/recall-tools.md | Updates recall-tool guidance to include availability-gated lcm_recent / debug usage and proof-safety. |
| skills/lossless-claw/SKILL.md | Updates skill overview and operating guidance for temporal recall + proof workflow. |
| openclaw.plugin.json | Exposes new config keys for rollup debug and task bridge tools. |
| docs/configuration.md | Documents new config flags and corresponding env vars. |
| README.md | Adds env var documentation for rollup debug enablement. |
| .changeset/lcm-temporal-skill-docs.md | Changeset for documentation/skill guidance updates. |
| .changeset/lcm-temporal-rollups.md | Changeset for temporal rollups + lcm_recent / debug tools. |
| .changeset/lcm-task-suggestion-tools.md | Changeset for opt-in suggestion tools. |
| .changeset/lcm-task-bridge-suggestions.md | Changeset for inert suggestion ledger storage. |
| .changeset/lcm-observed-work-density.md | Changeset for observed-work density model + tool. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Review-thread triage at current head
Local focused gates passed: |
Final adversarial pass - merge order 6/10, after #518Score: mergeability 9.4/10, functionality 8.7/10, description 9.5/10. Functionality audit: Works as opt-in task-suggestion preview/review tooling. Tools are behind Scenario coverage: Supports “should we create tasks from unfinished things?” as preview/ledger review only. It does not create or close tasks. Final state: Residual caveat: Must stay opt-in; no external task authority. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Final May 1 hardening/status update:
The PR description top note has been refreshed with current head SHA, visible-vs-logical LOC breakdown, scope, caveats, and validation status. LCM remains an evidence layer: recaps, observed work, events, episodes, and suggestions are entry points, not proof or task authority. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const reviewedBy = input.reviewedBy?.trim() || null; | ||
| const result = this.db.prepare( | ||
| `UPDATE lcm_task_bridge_suggestions | ||
| SET status = ?, | ||
| reviewed_by = COALESCE(?, reviewed_by), |
| accounting.maxOutputTokens = budget; | ||
| accounting.itemsReturned = countReturnedItems(next); | ||
| accounting.budgetTruncated = budgetTruncated; | ||
| accounting.truncated = Boolean(accounting.truncated) || budgetTruncated; | ||
| next.accounting = accounting; |
| description: "Reserved for a future bounded admin mode; currently rejected so density reads stay conversation-scoped.", | ||
| }) | ||
| ), | ||
| period: Type.Optional(Type.String({ description: 'Observed work period: "today", "yesterday", "7d", "30d", "week", "month", or "date:YYYY-MM-DD". Explicit since/before wins when provided.' })), |
|
|
||
| const LcmTaskSuggestionsSchema = Type.Object({ | ||
| conversationId: Type.Optional(Type.Number({ description: "Conversation ID to inspect. Defaults to the current session conversation." })), | ||
| allConversations: Type.Optional(Type.Boolean({ description: "Explicitly inspect all conversations. Defaults to false." })), |
PR #539: Opt-in task suggestion tools over the inert ledger
Maintainer Quick Read
74da88b9f720554a17c368f280348081a0f992c7Why Maintainers Should Care
This adds optional tools for previewing, recording, and reviewing task suggestions, but only behind an explicit config gate. It keeps the bridge review-led and prevents LCM from becoming a background task writer.
Stack Map
How It Works
flowchart TD A["taskBridgeToolsEnabled?" ] --> B{"enabled"} B -- "no" --> C["tools are not registered"] B -- "yes" --> D["preview suggestion"] D --> E{"record?"} E -- "no" --> F["dry-run output only"] E -- "yes" --> G["write suggestion ledger"] G --> H["review/dismiss/update ledger state"] H -. "never" .-> I["direct task write"]What Ships In This PR
What This PR Intentionally Does Not Do
How An Agent Uses It
Engineering Boundaries
lcm_describe,lcm_expand,lcm_expand_query, raw messages, GitHub, logs, tickets, or the relevant authority.includeSourcesor debug affordance.Primary Review Files
src/tools/lcm-task-suggestion-tools.tssrc/plugin/index.tssrc/store/task-bridge-suggestion-store.tstest/task-bridge-suggestion-store.test.tsSize And Review Surface
These are intentionally large LCM changes, so the body separates the GitHub-visible diff from the intended logical review slice. Later PRs target
main, which makes the GitHub Files tab include parent-stack code; reviewers should use the logical parent listed above when judging the slice.main#518Logical slice breakdown:
Review Concerns Already Folded Into The Code
julianday()correctness and now use matching expression indexes for indexed range/order plans.Validation Evidence
npm test -- --run test/task-bridge-suggestion-store.test.ts test/observed-work-store.test.tsnpm testnpm run buildgit diff --checktestcheck: successSuggested Maintainer Review Path
mainwhile the series is logically stacked.